From 59856fb1c94a00024c60cc73967d12edadf1b90a Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Wed, 13 Dec 2023 18:37:29 +0100 Subject: format: apply new format style Part-of: --- setup.py | 83 ++++++++++++++++++++++++++++++---------------------------------- 1 file changed, 39 insertions(+), 44 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 8bb1863c..94dc2344 100644 --- a/setup.py +++ b/setup.py @@ -45,26 +45,25 @@ def datafiles(prefix): files.append((os.path.join(datadir, dirpath), [f])) return files + # Intercept packages and recipes -packages = [x[len('--package='):] for x in sys.argv - if x.startswith('--package=')] -recipes = [x[len('--recipe='):] for x in sys.argv if x.startswith('--recipe=')] +packages = [x[len('--package=') :] for x in sys.argv if x.startswith('--package=')] +recipes = [x[len('--recipe=') :] for x in sys.argv if x.startswith('--recipe=')] if len(packages) == 0: packages = None if len(recipes) == 0: recipes = None -sys.argv = [x for x in sys.argv if not x.startswith('--package=') and - not x.startswith('--recipe=')] +sys.argv = [x for x in sys.argv if not x.startswith('--package=') and not x.startswith('--recipe=')] -#Fill manifest +# Fill manifest shutil.copy('MANIFEST.in.in', 'MANIFEST.in') with open('MANIFEST.in', 'a+') as f: for dirname in ['data', 'config', 'tools']: f.write('\n'.join(['include %s' % x for x in parse_dir(dirname)])) f.write('\n') - for (dirname, suffix) in [('packages', '.package'), ('recipes', '.recipe')]: + for dirname, suffix in [('packages', '.package'), ('recipes', '.recipe')]: filenames = parse_dir(dirname) requested = globals()[dirname] if requested: @@ -75,19 +74,19 @@ with open('MANIFEST.in', 'a+') as f: requested_dir = requested + ['gstreamer-1.0'] else: requested_dir = requested + ['build-tools', 'toolchain'] - requested_directories = tuple(os.path.join(dirname, x, "") - for x in requested_dir) - - filenames = [p for p in filenames - if p.startswith(requested_directories) or - p.endswith(requested_filenames) or - p.endswith('.py')] - - missing_files = [p for p in requested_filenames if - not [True for m in filenames if m.endswith(p)]] - assert not missing_files, \ - "Not all %s from the command line (%s) exist" % \ - (dirname, ", ".join(missing_files)) + requested_directories = tuple(os.path.join(dirname, x, '') for x in requested_dir) + + filenames = [ + p + for p in filenames + if p.startswith(requested_directories) or p.endswith(requested_filenames) or p.endswith('.py') + ] + + missing_files = [p for p in requested_filenames if not [True for m in filenames if m.endswith(p)]] + assert not missing_files, 'Not all %s from the command line (%s) exist' % ( + dirname, + ', '.join(missing_files), + ) f.write('\n'.join(['include %s' % x for x in filenames])) f.write('\n') @@ -99,14 +98,12 @@ if len(prefix) == 1: else: prefix = '/usr/local' + class extended_sdist(setuptools_sdist.sdist): user_options = setuptools_sdist.sdist.user_options + [ - ('source-dirs=', None, - "Comma-separated list of source directories to add to the package"), - ('package=', None, - "Specific package to include, other packages are not included"), - ('recipe=', None, - "Specific recipe to include, other recipes are not included"), + ('source-dirs=', None, 'Comma-separated list of source directories to add to the package'), + ('package=', None, 'Specific package to include, other packages are not included'), + ('recipe=', None, 'Specific recipe to include, other recipes are not included'), ] def initialize_options(self): @@ -122,30 +119,28 @@ class extended_sdist(setuptools_sdist.sdist): for d in self.source_dirs: src = d.rstrip().rstrip(os.sep) dest = os.path.join(base_dir, 'sources', os.path.basename(src)) - distutils.log.info("Copying %s -> %s", src, dest) - copy_tree(src, dest, update=not self.force, verbose=0, - dry_run=self.dry_run) + distutils.log.info('Copying %s -> %s', src, dest) + copy_tree(src, dest, update=not self.force, verbose=0, dry_run=self.dry_run) + setup( - name = "cerbero", - version = CERBERO_VERSION, - author = "Andoni Morales", - author_email = "amorales@fluendo.com", - description = ("Multi platform build system for Open Source projects"), - license = "LGPL", - url = "http://gstreamer.freedesktop.org/", - packages = find_packages(exclude=['tests']), + name='cerbero', + version=CERBERO_VERSION, + author='Andoni Morales', + author_email='amorales@fluendo.com', + description=('Multi platform build system for Open Source projects'), + license='LGPL', + url='http://gstreamer.freedesktop.org/', + packages=find_packages(exclude=['tests']), long_description=read('README.md'), - zip_safe = False, + zip_safe=False, include_package_data=True, - data_files = datafiles(prefix), - entry_points = """ + data_files=datafiles(prefix), + entry_points=""" [console_scripts] cerbero = cerbero.main:main""", classifiers=[ - "License :: OSI Approved :: LGPL License", + 'License :: OSI Approved :: LGPL License', ], - cmdclass = { - 'sdist' : extended_sdist - } + cmdclass={'sdist': extended_sdist}, ) -- cgit v1.2.3