def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: list[str]: lines of text. """ return self.make_spec_file(bdist_rpm._make_spec_file(self))
def _make_spec_file(self): """Change default build and install scripts.""" def_setup_call = "%s %s" % (self.python, os.path.basename(sys.argv[0])) if not self.build_script: # create build script build_script_file = NamedTemporaryFile(prefix='build_script') self.build_script = build_script_file.name def_build = "%s build" % def_setup_call if self.use_rpm_opt_flags: def_build = 'env CFLAGS="$RPM_OPT_FLAGS" ' + def_build if self.build_extra_opts: def_build = '%s %s' % (def_build, self.build_extra_opts.strip()) build_script_file.write(def_build) build_script_file.write('\n') # This is trick, so the file can be opened and read while we still have it opened. build_script_file.seek(0) if not self.install_script: # create install script install_script_file = NamedTemporaryFile(prefix='install_script') self.install_script = install_script_file.name def_install = "%s install -cO2 --force --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES" % def_setup_call if self.install_extra_opts: def_install = '%s %s' % (def_install, self.install_extra_opts.strip()) install_script_file.write(def_install) install_script_file.write('\n') # This is trick, so the file can be opened and read while we still have it opened. install_script_file.seek(0) return _bdist_rpm._make_spec_file(self)
def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: list[str]: lines of text. """ return self.make_spec_file( bdist_rpm._make_spec_file(self))
def _make_spec_file(self): specFile = _bdist_rpm._make_spec_file(self) line = next(i for i, s in enumerate(specFile) if s.startswith("%install")) specFile[ line + 1] += " --prefix=/usr --install-data=/usr/share --install-lib /usr/share/trelby" return specFile
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
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
def _make_spec_file(self): version = self.distribution.get_version() rpmversion = version.replace("-", "_") spec = _bdist_rpm._make_spec_file(self) line23 = "%define version " + version line24 = "%define version " + rpmversion spec = [ line.replace("Source0: %{name}-%{version}.tar", "Source0: %{name}-%{unmangled_version}.tar") .replace("setup.py install ", "setup.py install --single-version-externally-managed ") .replace("%setup", "%setup -n %{name}-%{unmangled_version}") .replace(line23, line24) for line in spec ] spec.insert(spec.index(line24) + 1, "%define unmangled_version " + version) return spec
def _make_spec_file(self): argv0 = sys.argv[0] features = [] for ext in self.distribution.ext_modules: if not isinstance(ext, Extension): continue with_ext = getattr(self.distribution, ext.attr_name) if with_ext is None: continue if with_ext: features.append('--'+ext.option_name) else: features.append('--'+ext.neg_option_name) sys.argv[0] = ' '.join([argv0]+features) spec_file = _bdist_rpm._make_spec_file(self) sys.argv[0] = argv0 return spec_file
def _make_spec_file(self): argv0 = sys.argv[0] features = [] for ext in self.distribution.ext_modules: if not isinstance(ext, Extension): continue with_ext = getattr(self.distribution, ext.attr_name) if with_ext is None: continue if with_ext: features.append('--'+ext.option_name) else: features.append('--'+ext.neg_option_name) sys.argv[0] = ' '.join([argv0]+features) spec_file = _bdist_rpm._make_spec_file(self) sys.argv[0] = argv0 return spec_file
def _make_spec_file(self): version = self.distribution.get_version() rpmversion = version.replace('-', '_') spec = _bdist_rpm._make_spec_file(self) line23 = '%define version ' + version line24 = '%define version ' + rpmversion spec = [ line.replace( "Source0: %{name}-%{version}.tar", "Source0: %{name}-%{unmangled_version}.tar").replace( "setup.py install ", "setup.py install --single-version-externally-managed "). replace("%setup", "%setup -n %{name}-%{unmangled_version}").replace( line23, line24) for line in spec ] spec.insert( spec.index(line24) + 1, "%define unmangled_version " + version) return spec
def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: list[str]: lines of the RPM spec file. """ # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, self)._make_spec_file() else: spec_file = bdist_rpm._make_spec_file(self) python_package = 'python3' description = [] requires = '' summary = '' in_description = False python_spec_file = [] for line in iter(spec_file): if line.startswith('Summary: '): summary = line[9:] elif line.startswith('BuildRequires: '): line = 'BuildRequires: {0:s}-setuptools, {0:s}-devel'.format( python_package) elif line.startswith('Requires: '): requires = line[10:] continue elif line.startswith('%description'): in_description = True elif line.startswith('python setup.py build'): if python_package == 'python3': line = '%py3_build' else: line = '%py2_build' elif line.startswith('python setup.py install'): if python_package == 'python3': line = '%py3_install' else: line = '%py2_install' elif line.startswith('%files'): lines = [ '%files -n {0:s}-%{{name}}'.format(python_package), '%defattr(644,root,root,755)', '%license LICENSE', '%doc ACKNOWLEDGEMENTS AUTHORS README'] lines.extend([ '%{python3_sitelib}/winevtrc/*.py', '%{python3_sitelib}/winevtrc*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*', '%exclude %{python3_sitelib}/winevtrc/__pycache__/*', '%exclude %{_bindir}/*.py']) python_spec_file.extend(lines) break elif line.startswith('%prep'): in_description = False python_spec_file.append( '%package -n {0:s}-%{{name}}'.format(python_package)) python_summary = 'Python 3 module of {0:s}'.format(summary) if requires: python_spec_file.append('Requires: {0:s}'.format(requires)) python_spec_file.extend([ 'Summary: {0:s}'.format(python_summary), '', '%description -n {0:s}-%{{name}}'.format(python_package)]) python_spec_file.extend(description) elif in_description: # Ignore leading white lines in the description. if not description and not line: continue description.append(line) python_spec_file.append(line) return python_spec_file
def make_spec_file(self, spec_file): """Make an RPM Spec file.""" # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, self)._make_spec_file() else: spec_file = bdist_rpm._make_spec_file(self) if sys.version_info[0] < 3: python_package = 'python2' else: python_package = 'python3' description = [] requires = '' summary = '' in_description = False python_spec_file = [] for line in iter(spec_file): if line.startswith('Summary: '): summary = line elif line.startswith('BuildRequires: '): line = 'BuildRequires: {0:s}-setuptools, {0:s}-devel'.format( python_package) elif line.startswith('Requires: '): requires = line[10:] if python_package == 'python3': requires = requires.replace('python-', 'python3-') requires = requires.replace('python2-', 'python3-') elif line.startswith('%description'): in_description = True elif line.startswith('python setup.py build'): if python_package == 'python3': line = '%py3_build' else: line = '%py2_build' elif line.startswith('python setup.py install'): if python_package == 'python3': line = '%py3_install' else: line = '%py2_install' elif line.startswith('%files'): lines = [ '%files -n {0:s}-%{{name}}'.format(python_package), '%defattr(644,root,root,755)', '%license LICENSE', '%doc README'] if python_package == 'python3': lines.extend([ '%{_libdir}/python3*/site-packages/*.so', '%{_libdir}/python3*/site-packages/pytsk3*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*']) else: lines.extend([ '%{_libdir}/python2*/site-packages/*.so', '%{_libdir}/python2*/site-packages/pytsk3*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*']) python_spec_file.extend(lines) break elif line.startswith('%prep'): in_description = False python_spec_file.append( '%package -n {0:s}-%{{name}}'.format(python_package)) if python_package == 'python2': python_spec_file.extend([ 'Obsoletes: python-pytsk3 < %{version}', 'Provides: python-pytsk3 = %{version}']) if requires: python_spec_file.append('Requires: {0:s}'.format(requires)) python_spec_file.extend([ '{0:s}'.format(summary), '', '%description -n {0:s}-%{{name}}'.format(python_package)]) python_spec_file.extend(description) elif in_description: # Ignore leading white lines in the description. if not description and not line: continue description.append(line) python_spec_file.append(line) return python_spec_file
def make_spec_file(self, spec_file): """Make an RPM Spec file.""" # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, self)._make_spec_file() else: spec_file = bdist_rpm._make_spec_file(self) if sys.version_info[0] < 3: python_package = 'python2' else: python_package = 'python3' description = [] requires = '' summary = '' in_description = False python_spec_file = [] for line in iter(spec_file): if line.startswith('Summary: '): summary = line elif line.startswith('BuildRequires: '): line = 'BuildRequires: {0:s}-setuptools, {0:s}-devel'.format( python_package) elif line.startswith('Requires: '): requires = line[10:] if python_package == 'python3': requires = requires.replace('python-', 'python3-') requires = requires.replace('python2-', 'python3-') elif line.startswith('%description'): in_description = True elif line.startswith('python setup.py build'): if python_package == 'python3': line = '%py3_build' else: line = '%py2_build' elif line.startswith('python setup.py install'): if python_package == 'python3': line = '%py3_install' else: line = '%py2_install' elif line.startswith('%files'): lines = [ '%files -n {0:s}-%{{name}}'.format(python_package), '%defattr(644,root,root,755)', '%license LICENSE', '%doc README' ] if python_package == 'python3': lines.extend([ '%{_libdir}/python3*/site-packages/*.so', '%{_libdir}/python3*/site-packages/pytsk3*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*' ]) else: lines.extend([ '%{_libdir}/python2*/site-packages/*.so', '%{_libdir}/python2*/site-packages/pytsk3*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*' ]) python_spec_file.extend(lines) break elif line.startswith('%prep'): in_description = False python_spec_file.append( '%package -n {0:s}-%{{name}}'.format(python_package)) if python_package == 'python2': python_spec_file.extend([ 'Obsoletes: python-pytsk3 < %{version}', 'Provides: python-pytsk3 = %{version}' ]) if requires: python_spec_file.append( 'Requires: {0:s}'.format(requires)) python_spec_file.extend([ '{0:s}'.format(summary), '', '%description -n {0:s}-%{{name}}'.format( python_package) ]) python_spec_file.extend(description) elif in_description: # Ignore leading white lines in the description. if not description and not line: continue description.append(line) python_spec_file.append(line) return python_spec_file
def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: list[str]: lines of the RPM spec file. """ # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, self)._make_spec_file() else: spec_file = bdist_rpm._make_spec_file(self) if sys.version_info[0] < 3: python_package = 'python' else: python_package = 'python3' description = [] summary = '' in_description = False python_spec_file = [] for line in iter(spec_file): if line.startswith('Summary: '): summary = line elif line.startswith('BuildRequires: '): line = 'BuildRequires: {0:s}-setuptools'.format(python_package) elif line.startswith('Requires: '): if python_package == 'python3': line = line.replace('python', 'python3') elif line.startswith('%description'): in_description = True elif line.startswith('%files'): # Cannot use %{_libdir} here since it can expand to "lib64". lines = [ '%files -n {0:s}-%{{name}}'.format(python_package), '%defattr(644,root,root,755)', '%doc ACKNOWLEDGEMENTS AUTHORS LICENSE', '%{_prefix}/lib/python*/site-packages/**/*.py', '%{_prefix}/lib/python*/site-packages/dftimewolf*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*', '%exclude %{_prefix}/lib/python*/site-packages/**/*.pyc', '%exclude %{_prefix}/lib/python*/site-packages/**/*.pyo', '%exclude %{_prefix}/lib/python*/site-packages/**/__pycache__/*'] python_spec_file.extend(lines) break elif line.startswith('%prep'): in_description = False python_spec_file.append( '%package -n {0:s}-%{{name}}'.format(python_package)) python_spec_file.append('{0:s}'.format(summary)) python_spec_file.append('') python_spec_file.append( '%description -n {0:s}-%{{name}}'.format(python_package)) python_spec_file.extend(description) elif in_description: # Ignore leading white lines in the description. if not description and not line: continue description.append(line) python_spec_file.append(line) return python_spec_file
def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: list[str]: lines of the RPM spec file. """ # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, self)._make_spec_file() else: spec_file = bdist_rpm._make_spec_file(self) if sys.version_info[0] < 3: python_package = 'python' else: python_package = 'python3' description = [] summary = '' in_description = False python_spec_file = [] for line in iter(spec_file): if line.startswith('Summary: '): summary = line elif line.startswith('BuildRequires: '): line = 'BuildRequires: {0:s}-setuptools'.format( python_package) elif line.startswith('Requires: '): if python_package == 'python3': line = line.replace('python', 'python3') elif line.startswith('%description'): in_description = True elif line.startswith('%files'): line = '%files -f INSTALLED_FILES -n {0:s}-%{{name}}'.format( python_package) elif line.startswith('%prep'): in_description = False python_spec_file.append( '%package -n {0:s}-%{{name}}'.format(python_package)) python_spec_file.append('{0:s}'.format(summary)) python_spec_file.append('') python_spec_file.append( '%description -n {0:s}-%{{name}}'.format( python_package)) python_spec_file.extend(description) elif in_description: # Ignore leading white lines in the description. if not description and not line: continue description.append(line) python_spec_file.append(line) return python_spec_file
def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: list[str]: lines of the RPM spec file. """ # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, self)._make_spec_file() else: spec_file = bdist_rpm._make_spec_file(self) if sys.version_info[0] < 3: python_package = 'python2' else: python_package = 'python3' description = [] summary = '' in_description = False python_spec_file = [] for line in iter(spec_file): if line.startswith('Summary: '): summary = line elif line.startswith('BuildRequires: '): line = 'BuildRequires: {0:s}-setuptools, {0:s}-devel'.format( python_package) elif line.startswith('Requires: '): if python_package == 'python3': line = line.replace('python-', 'python3-') line = line.replace('python2-', 'python3-') elif line.startswith('%description'): in_description = True elif line.startswith('python setup.py build'): if python_package == 'python3': line = '%py3_build' else: line = '%py2_build' elif line.startswith('python setup.py install'): if python_package == 'python3': line = '%py3_install' else: line = '%py2_install' elif line.startswith('%files'): lines = [ '%files -n {0:s}-%{{name}}'.format(python_package), '%defattr(644,root,root,755)', '%doc ACKNOWLEDGEMENTS AUTHORS LICENSE README' ] if python_package == 'python3': lines.extend([ '%{python3_sitelib}/**/*.py', '%{python3_sitelib}/dfdatetime*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*', '%exclude %{python3_sitelib}/**/__pycache__/*' ]) else: lines.extend([ '%{python2_sitelib}/**/*.py', '%{python2_sitelib}/dfdatetime*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*', '%exclude %{python2_sitelib}/**/*.pyc', '%exclude %{python2_sitelib}/**/*.pyo' ]) python_spec_file.extend(lines) break elif line.startswith('%prep'): in_description = False python_spec_file.append( '%package -n {0:s}-%{{name}}'.format(python_package)) if python_package == 'python2': python_spec_file.append( 'Obsoletes: python-dfdatetime < %{version}') python_spec_file.append( 'Provides: python-dfdatetime = %{version}') python_spec_file.append('{0:s}'.format(summary)) python_spec_file.append('') python_spec_file.append( '%description -n {0:s}-%{{name}}'.format( python_package)) python_spec_file.extend(description) elif in_description: # Ignore leading white lines in the description. if not description and not line: continue description.append(line) python_spec_file.append(line) return python_spec_file
def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: list[str]: lines of the RPM spec file. """ # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, self)._make_spec_file() else: spec_file = bdist_rpm._make_spec_file(self) if sys.version_info[0] < 3: python_package = 'python' else: python_package = 'python3' description = [] summary = '' in_description = False python_spec_file = [] for line in iter(spec_file): if line.startswith('Summary: '): summary = line elif line.startswith('BuildRequires: '): line = 'BuildRequires: {0:s}-setuptools'.format( python_package) elif line.startswith('Requires: '): if python_package == 'python3': line = line.replace('python', 'python3') elif line.startswith('%description'): in_description = True elif line.startswith('%files'): # Cannot use %{_libdir} here since it can expand to "lib64". lines = [ '%files -n {0:s}-%{{name}}'.format(python_package), '%defattr(644,root,root,755)', '%doc ACKNOWLEDGEMENTS AUTHORS LICENSE README', '%{_prefix}/lib/python*/site-packages/**/*.py', '%{_prefix}/lib/python*/site-packages/dtfabric*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*', '%exclude %{_prefix}/lib/python*/site-packages/**/*.pyc', '%exclude %{_prefix}/lib/python*/site-packages/**/*.pyo', '%exclude %{_prefix}/lib/python*/site-packages/**/__pycache__/*' ] python_spec_file.extend(lines) break elif line.startswith('%prep'): in_description = False python_spec_file.append( '%package -n {0:s}-%{{name}}'.format(python_package)) python_spec_file.append('{0:s}'.format(summary)) python_spec_file.append('') python_spec_file.append( '%description -n {0:s}-%{{name}}'.format( python_package)) python_spec_file.extend(description) elif in_description: # Ignore leading white lines in the description. if not description and not line: continue description.append(line) python_spec_file.append(line) return python_spec_file
def _make_spec_file(self): specFile = _bdist_rpm._make_spec_file(self) line = next(i for i, s in enumerate(specFile) if s.startswith("%install")) specFile[line+1] += " --prefix=/usr --install-data=/usr/share --install-lib /usr/share/trelby" return specFile
def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: list[str]: lines of the RPM spec file. """ # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, self)._make_spec_file() else: spec_file = bdist_rpm._make_spec_file(self) if sys.version_info[0] < 3: python_package = 'python2' else: python_package = 'python3' description = [] requires = '' summary = '' in_description = False python_spec_file = [] for line in iter(spec_file): if line.startswith('Summary: '): summary = line[9:] elif line.startswith('BuildRequires: '): line = 'BuildRequires: {0:s}-setuptools, {0:s}-devel'.format( python_package) elif line.startswith('Requires: '): requires = line[10:] if python_package == 'python3': requires = requires.replace('python-', 'python3-') requires = requires.replace('python2-', 'python3-') continue elif line.startswith('%description'): in_description = True elif line.startswith('python setup.py build'): if python_package == 'python3': line = '%py3_build' else: line = '%py2_build' elif line.startswith('python setup.py install'): if python_package == 'python3': line = '%py3_install' else: line = '%py2_install' elif line.startswith('%files'): python_spec_file.extend([ '%package -n %{name}-tools', 'Requires: python-artifacts', 'Summary: Tools for {0:s}'.format(summary), '', '%description -n %{name}-tools' ]) python_spec_file.extend(description) lines = [ '%files -n %{name}-data', '%defattr(644,root,root,755)', '%license LICENSE', '%doc ACKNOWLEDGEMENTS AUTHORS README', '%{_datadir}/%{name}/*', '', '%files -n {0:s}-%{{name}}'.format(python_package), '%defattr(644,root,root,755)', '%license LICENSE', '%doc ACKNOWLEDGEMENTS AUTHORS README' ] if python_package == 'python3': lines.extend([ '%{python3_sitelib}/artifacts/*.py', '%{python3_sitelib}/artifacts*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*', '%exclude %{python3_sitelib}/artifacts/__pycache__/*' ]) else: lines.extend([ '%{python2_sitelib}/artifacts/*.py', '%{python2_sitelib}/artifacts*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*', '%exclude %{python2_sitelib}/artifacts/*.pyc', '%exclude %{python2_sitelib}/artifacts/*.pyo' ]) python_spec_file.extend(lines) break elif line.startswith('%prep'): in_description = False python_spec_file.extend([ '%package -n %{name}-data', 'Summary: Data files for {0:s}'.format(summary), '', '%description -n %{name}-data' ]) python_spec_file.extend(description) python_spec_file.append( '%package -n {0:s}-%{{name}}'.format(python_package)) if python_package == 'python2': python_spec_file.extend([ 'Obsoletes: python-artifacts < %{version}', 'Provides: python-artifacts = %{version}' ]) python_summary = 'Python 2 module of {0:s}'.format( summary) else: python_summary = 'Python 3 module of {0:s}'.format( summary) python_spec_file.extend([ 'Requires: artifacts-data {0:s}'.format(requires), 'Summary: {0:s}'.format(python_summary), '', '%description -n {0:s}-%{{name}}'.format( python_package) ]) python_spec_file.extend(description) elif in_description: # Ignore leading white lines in the description. if not description and not line: continue description.append(line) python_spec_file.append(line) python_spec_file.extend( ['', '%files -n %{name}-tools', '%{_bindir}/*.py']) return python_spec_file
def _make_spec_file(self): """Generates the text of an RPM spec file. Returns: list[str]: lines of the RPM spec file. """ # Note that bdist_rpm can be an old style class. if issubclass(BdistRPMCommand, object): spec_file = super(BdistRPMCommand, self)._make_spec_file() else: spec_file = bdist_rpm._make_spec_file(self) if sys.version_info[0] < 3: python_package = 'python2' else: python_package = 'python3' description = [] requires = '' summary = '' in_description = False python_spec_file = [] for line in iter(spec_file): if line.startswith('Summary: '): summary = line[9:] elif line.startswith('BuildRequires: '): line = 'BuildRequires: {0:s}-setuptools, {0:s}-devel'.format( python_package) elif line.startswith('Requires: '): requires = line[10:] if python_package == 'python3': requires = requires.replace('python-', 'python3-') requires = requires.replace('python2-', 'python3-') continue elif line.startswith('%description'): in_description = True elif line.startswith('python setup.py build'): if python_package == 'python3': line = '%py3_build' else: line = '%py2_build' elif line.startswith('python setup.py install'): if python_package == 'python3': line = '%py3_install' else: line = '%py2_install' elif line.startswith('%files'): python_spec_file.extend([ '%package -n %{name}-tools', 'Requires: {0:s}-l2tdevtools'.format(python_package), 'Summary: Tools for {0:s}'.format(summary), '', '%description -n %{name}-tools']) python_spec_file.extend(description) lines = [ '%files -n %{name}-data', '%defattr(644,root,root,755)', '%license LICENSE', '%doc ACKNOWLEDGEMENTS AUTHORS README', '%{_datadir}/%{name}/*', '', '%files -n {0:s}-%{{name}}'.format(python_package), '%defattr(644,root,root,755)', '%license LICENSE', '%doc ACKNOWLEDGEMENTS AUTHORS README'] if python_package == 'python3': lines.extend([ '%{python3_sitelib}/l2tdevtools/*.py', '%{python3_sitelib}/l2tdevtools/*/*.py', '%{python3_sitelib}/l2tdevtools*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*', '%exclude %{python3_sitelib}/l2tdevtools/__pycache__/*', '%exclude %{python3_sitelib}/l2tdevtools/*/__pycache__/*']) else: lines.extend([ '%{python2_sitelib}/l2tdevtools/*.py', '%{python2_sitelib}/l2tdevtools/*/*.py', '%{python2_sitelib}/l2tdevtools*.egg-info/*', '', '%exclude %{_prefix}/share/doc/*', '%exclude %{python2_sitelib}/l2tdevtools/*.pyc', '%exclude %{python2_sitelib}/l2tdevtools/*.pyo', '%exclude %{python2_sitelib}/l2tdevtools/*/*.pyc', '%exclude %{python2_sitelib}/l2tdevtools/*/*.pyo']) python_spec_file.extend(lines) break elif line.startswith('%prep'): in_description = False python_spec_file.extend([ '%package -n %{name}-data', 'Summary: Data files for {0:s}'.format(summary), '', '%description -n %{name}-data']) python_spec_file.extend(description) python_spec_file.append( '%package -n {0:s}-%{{name}}'.format(python_package)) if python_package == 'python2': python_spec_file.extend([ 'Obsoletes: python-l2tdevtools < %{version}', 'Provides: python-l2tdevtools = %{version}']) python_summary = 'Python 2 module of {0:s}'.format(summary) else: python_summary = 'Python 3 module of {0:s}'.format(summary) python_spec_file.extend([ 'Requires: l2tdevtools-data {0:s}'.format(requires), 'Summary: {0:s}'.format(python_summary), '', '%description -n {0:s}-%{{name}}'.format(python_package)]) python_spec_file.extend(description) elif in_description: # Ignore leading white lines in the description. if not description and not line: continue description.append(line) python_spec_file.append(line) python_spec_file.extend([ '', '%files -n %{name}-tools', '%{_bindir}/*.py']) return python_spec_file