From 99e5f91bd2df3314d6b0fee8ad6dc094efdefdba Mon Sep 17 00:00:00 2001 From: Seung Yeop Yang Date: Fri, 1 Nov 2019 03:47:18 -0500 Subject: [PATCH] resolve pylint conventions and warnings --- setup.py | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/setup.py b/setup.py index ae4ba11..e737d23 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,9 @@ # Note: To use the 'upload' functionality of this file, you must: # $ pipenv install twine --dev +""" +setup.py for human +""" import io import os @@ -33,26 +36,26 @@ # The rest you shouldn't have to touch too much :) # ------------------------------------------------ # Except, perhaps the License and Trove Classifiers! -# If you do change the License, remember to change the Trove Classifier for that! +# If you change the License, remember to change the Trove Classifier for that! -here = os.path.abspath(os.path.dirname(__file__)) +HERE = os.path.abspath(os.path.dirname(__file__)) # Import the README and use it as the long-description. # Note: this will only work if 'README.md' is present in your MANIFEST.in file! try: - with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f: - long_description = '\n' + f.read() + with io.open(os.path.join(HERE, 'README.md'), encoding='utf-8') as f: + LONG_DESCRIPTION = '\n' + f.read() except FileNotFoundError: - long_description = DESCRIPTION + LONG_DESCRIPTION = DESCRIPTION # Load the package's __version__.py module as a dictionary. -about = {} +ABOUT = {} if not VERSION: - project_slug = NAME.lower().replace("-", "_").replace(" ", "_") - with open(os.path.join(here, project_slug, '__version__.py')) as f: - exec(f.read(), about) + PROJECT_SLUG = NAME.lower().replace("-", "_").replace(" ", "_") + with open(os.path.join(HERE, PROJECT_SLUG, '__version__.py')) as f: + exec(f.read(), ABOUT) # pylint: disable=W0122 else: - about['__version__'] = VERSION + ABOUT['__version__'] = VERSION class UploadCommand(Command): @@ -62,31 +65,34 @@ class UploadCommand(Command): user_options = [] @staticmethod - def status(s): + def status(stat): """Prints things in bold.""" - print('\033[1m{0}\033[0m'.format(s)) + print('\033[1m{0}\033[0m'.format(stat)) def initialize_options(self): - pass + """Initialize Options""" def finalize_options(self): - pass + """Finalize Options""" def run(self): + """Cleanup, build, upload, and git tag""" try: self.status('Removing previous builds…') - rmtree(os.path.join(here, 'dist')) + rmtree(os.path.join(HERE, 'dist')) except OSError: pass self.status('Building Source and Wheel (universal) distribution…') - os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable)) + os.system( + '{0} setup.py sdist bdist_wheel --universal'.format(sys.executable) + ) self.status('Uploading the package to PyPI via Twine…') os.system('twine upload dist/*') self.status('Pushing git tags…') - os.system('git tag v{0}'.format(about['__version__'])) + os.system('git tag v{0}'.format(ABOUT['__version__'])) os.system('git push --tags') sys.exit() @@ -95,15 +101,17 @@ def run(self): # Where the magic happens: setup( name=NAME, - version=about['__version__'], + version=ABOUT['__version__'], description=DESCRIPTION, - long_description=long_description, + long_description=LONG_DESCRIPTION, long_description_content_type='text/markdown', author=AUTHOR, author_email=EMAIL, python_requires=REQUIRES_PYTHON, url=URL, - packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]), + packages=find_packages( + exclude=["tests", "*.tests", "*.tests.*", "tests.*"] + ), # If your package is a single module, use this instead of 'packages': # py_modules=['mypackage'],