Ejemplo n.º 1
0
    def _make_spec_file(self):
        """Generates the text of an RPM spec file.

        Returns:
          A list of strings containing the lines of text.
        """
        return self.make_spec_file(bdist_rpm._make_spec_file(self))
Ejemplo n.º 2
0
    def _make_spec_file(self):
        # Make the package name python3-pympress instead of pympress
        # NB: %{name} evaluates to the RPM package name
        spec = [
            line.replace('%{name}', '%{pythonname}')
                .replace('define name ', 'define pythonname ')
                .replace('Name: %{pythonname}', 'Name: python3-%{pythonname}')
            for line in bdist_rpm._make_spec_file(self) if not line.startswith('Group:')
        ]

        insert_pos = find_index_startstring(spec, 'Requires:') + 1
        insert = [
            # Define what this package provides in terms of capabilities
            'Provides: python3dist(%{pythonname}) = %{version}',
            'Provides: python%{python3_version}dist(%{pythonname}) = %{version}',

            # For Fedora, this adds python-name to provides if python3 is the default
            '%{?python_provide:%python_provide python3-%{pythonname}}',
        ]

        if self.recommends:
            insert.append('Recommends: ' + ' '.join(self.recommends))

        if self.suggests:
            insert.append('Suggests: ' + ' '.join(self.suggests))

        # Roll our own py3_dist if it doesn’t exist on this platform, only for requires.
        # Also define typelib_deps if we are on suse or mageia, to specify dependencies using typelib capabilities.
        return [
            '%define normalize() %(echo %* | tr "[:upper:]_ " "[:lower:]--")',
            '%{?!py3_dist:%define py3_dist() (python%{python3_version}dist(%{normalize %1}) or python3-%1)}',
            '%{?suse_version:%define typelib_deps 1}', '%{?mga_version:%define typelib_deps 1}', ''
        ] + spec[:insert_pos] + insert + spec[insert_pos:]
Ejemplo n.º 3
0
 def _make_spec_file(self):
     spec_file = bdist_rpm._make_spec_file(self)
     # Add tests to the spec file
     if self.add_test:
         test_call = "%s setup.py test" % self.python
         spec_file.extend(['', '%check', test_call])
     # Change dist name
     if self.dist_name:
         spec_file[0] = "%define name " + self.dist_name
     return spec_file
Ejemplo n.º 4
0
 def _make_spec_file(self):
     spec_file = bdist_rpm._make_spec_file(self)
     # Add tests to the spec file
     if self.add_test:
         test_call = "%s setup.py test" % self.python
         spec_file.extend(['', '%check', test_call])
     # Change dist name
     if self.dist_name:
         spec_file[0] = "%define name " + self.dist_name
     return spec_file
Ejemplo n.º 5
0
    def _make_spec_file(self):
        spec_file = old_bdist_rpm._make_spec_file(self)

        # Replace hardcoded setup.py script name
        # with the real setup script name.
        setup_py = os.path.basename(sys.argv[0])
        if setup_py == 'setup.py':
            return spec_file
        new_spec_file = []
        for line in spec_file:
            line = line.replace('setup.py',setup_py)
            new_spec_file.append(line)
        return new_spec_file
Ejemplo n.º 6
0
    def _make_spec_file(self):
        spec_file = old_bdist_rpm._make_spec_file(self)

        # Replace hardcoded setup.py script name
        # with the real setup script name.
        setup_py = os.path.basename(sys.argv[0])
        if setup_py == 'setup.py':
            return spec_file
        new_spec_file = []
        for line in spec_file:
            line = line.replace('setup.py',setup_py)
            new_spec_file.append(line)
        return new_spec_file
Ejemplo n.º 7
0
 def _make_spec_file(self):
     spec = bdist_rpm._make_spec_file(self)
     if self.macros:
         spec = [l.strip() for l in open(self.macros).readlines()] + spec
     return spec