From da120f4acb3f8cd58709294cb013ec39c2410f5f Mon Sep 17 00:00:00 2001 From: Liam Deacon Date: Thu, 14 Jun 2018 14:03:53 +0100 Subject: [PATCH 1/6] Create setup.py --- setup.py | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..45e7d83 --- /dev/null +++ b/setup.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Note: To use the 'upload' functionality of this file, you must: +# $ pip install twine + +import io +import os +import sys +from shutil import rmtree + +from setuptools import find_packages, setup, Command + +# Package meta-data. +NAME = 'py532lib' +DESCRIPTION = 'Python wrapper around C library for RFID 532 reader' +REQUIRES_PYTHON = '>=3.6.0' +VERSION = None + +# 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! + +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! +with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f: + long_description = '\n' + f.read() + +# Load the package's __version__.py module as a dictionary. +about = {} +if not VERSION: + with open(os.path.join(here, NAME, '__version__.py')) as f: + exec(f.read(), about) +else: + about['__version__'] = VERSION + + +class UploadCommand(Command): + """Support setup.py upload.""" + + description = 'Build and publish the package.' + user_options = [] + + @staticmethod + def status(s): + """Prints things in bold.""" + print('\033[1m{0}\033[0m'.format(s)) + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + try: + self.status('Removing previous builds…') + 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)) + + 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 push --tags') + + sys.exit() + + +# Where the magic happens: +setup( + name=NAME, + version=about['__version__'], + description=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',)), + # If your package is a single module, use this instead of 'packages': + # py_modules=['mypackage'], + + # entry_points={ + # 'console_scripts': ['mycli=mymodule:cli'], + # }, + install_requires=REQUIRED, + include_package_data=True, + license='MIT', + classifiers=[ + # Trove classifiers + # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy' + ], + # $ setup.py publish support. + cmdclass={ + 'upload': UploadCommand, + }, +) From 6e64ef9dfdc00c1ed8d70581b1b6eb628bfe95f3 Mon Sep 17 00:00:00 2001 From: Liam Deacon Date: Thu, 14 Jun 2018 14:05:29 +0100 Subject: [PATCH 2/6] Create __version__.py --- py532lib/__version__.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 py532lib/__version__.py diff --git a/py532lib/__version__.py b/py532lib/__version__.py new file mode 100644 index 0000000..fd4c5d4 --- /dev/null +++ b/py532lib/__version__.py @@ -0,0 +1 @@ +2018.06.14.dev1 From eccd3b2ca14ba8f83a6b121a0ad6e796ef8baa41 Mon Sep 17 00:00:00 2001 From: Liam Deacon Date: Thu, 14 Jun 2018 14:10:46 +0100 Subject: [PATCH 3/6] Update __version__.py --- py532lib/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py532lib/__version__.py b/py532lib/__version__.py index fd4c5d4..d63c5ee 100644 --- a/py532lib/__version__.py +++ b/py532lib/__version__.py @@ -1 +1 @@ -2018.06.14.dev1 +__version__ = "2018.06.14.dev1" From b0ec5f975894c72a3d98b028f5ed0ff1654eb4fb Mon Sep 17 00:00:00 2001 From: Liam Deacon Date: Thu, 14 Jun 2018 14:13:29 +0100 Subject: [PATCH 4/6] Update setup.py --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index 45e7d83..48899b3 100644 --- a/setup.py +++ b/setup.py @@ -16,6 +16,9 @@ DESCRIPTION = 'Python wrapper around C library for RFID 532 reader' REQUIRES_PYTHON = '>=3.6.0' VERSION = None +AUTHOR = "DanyO" +EMAIL = "me@danyo.ca" +MAINTAINER = "Liam Deacon" # The rest you shouldn't have to touch too much :) # ------------------------------------------------ From 7d2c252cda8d396d36dfba7b216cf3573d433933 Mon Sep 17 00:00:00 2001 From: Liam Deacon Date: Thu, 14 Jun 2018 14:15:19 +0100 Subject: [PATCH 5/6] Fix license --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 48899b3..7c65d2a 100644 --- a/setup.py +++ b/setup.py @@ -98,7 +98,7 @@ def run(self): # }, install_requires=REQUIRED, include_package_data=True, - license='MIT', + license='BSD 2 Clause license', classifiers=[ # Trove classifiers # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers From a268e6bf3c05f18d817b65cde06d75d3108d32ae Mon Sep 17 00:00:00 2001 From: Liam Deacon Date: Thu, 14 Jun 2018 14:22:08 +0100 Subject: [PATCH 6/6] Fixed pip install --- setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 7c65d2a..9b97b1e 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ # Package meta-data. NAME = 'py532lib' DESCRIPTION = 'Python wrapper around C library for RFID 532 reader' -REQUIRES_PYTHON = '>=3.6.0' +REQUIRES_PYTHON = '>=2.7' VERSION = None AUTHOR = "DanyO" EMAIL = "me@danyo.ca" @@ -88,7 +88,6 @@ def run(self): author=AUTHOR, author_email=EMAIL, python_requires=REQUIRES_PYTHON, - url=URL, packages=find_packages(exclude=('tests',)), # If your package is a single module, use this instead of 'packages': # py_modules=['mypackage'], @@ -96,7 +95,7 @@ def run(self): # entry_points={ # 'console_scripts': ['mycli=mymodule:cli'], # }, - install_requires=REQUIRED, + install_requires=[], include_package_data=True, license='BSD 2 Clause license', classifiers=[