Update setup.py
This commit is contained in:
parent
80d786e993
commit
4e0c5d3cb7
73
setup.py
73
setup.py
@ -8,7 +8,7 @@ import codecs
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup, Command
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
|
|
||||||
# Package meta-data.
|
# Package meta-data.
|
||||||
@ -18,6 +18,18 @@ URL = 'https://github.com/me/myproject'
|
|||||||
EMAIL = 'me@example.com'
|
EMAIL = 'me@example.com'
|
||||||
AUTHOR = 'Awesome Soul'
|
AUTHOR = 'Awesome Soul'
|
||||||
|
|
||||||
|
# What packages are required for this module to be executed?
|
||||||
|
REQUIRED = [
|
||||||
|
# 'requests', 'maya', 'records',
|
||||||
|
]
|
||||||
|
|
||||||
|
# Dependencies only for versions less than Python 2.7:
|
||||||
|
# if sys.version_info < (2, 7):
|
||||||
|
# REQUIRED.append('requests[security]')
|
||||||
|
|
||||||
|
# The rest you shouldn't have to touch too much :)
|
||||||
|
# ------------------------------------------------
|
||||||
|
|
||||||
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.
|
# Import the README and use it as the long-description.
|
||||||
@ -29,30 +41,38 @@ about = {}
|
|||||||
with open(os.path.join(here, NAME, "__version__.py")) as f:
|
with open(os.path.join(here, NAME, "__version__.py")) as f:
|
||||||
exec(f.read(), about)
|
exec(f.read(), about)
|
||||||
|
|
||||||
# What packages are required for this module to be executed?
|
def status(s):
|
||||||
required = [
|
"""Prints things in bold."""
|
||||||
# 'requests', 'maya', 'records',
|
print('\033[1m{0}\033[0m'.format(s))
|
||||||
]
|
|
||||||
|
|
||||||
# Dependencies only for versions less than Python 2.7:
|
|
||||||
# if sys.version_info < (2, 7):
|
|
||||||
# required.append('requests[security]')
|
|
||||||
|
|
||||||
# Support "$ setup.py publish".
|
class PublishCommand(Command):
|
||||||
if sys.argv[-1] == "publish":
|
"""Support setup.py publish."""
|
||||||
try:
|
|
||||||
# Remove previous builds from the source tree.
|
description = "Build and publish the package."
|
||||||
rmtree(os.sep.join(('.', 'dist')))
|
user_options = []
|
||||||
except FileNotFoundError:
|
|
||||||
|
def initialize_options(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Create Source and Wheel (universal) distributions.
|
def finalize_options(self):
|
||||||
os.system("{0} setup.py sdist bdist_wheel --universal ".format(sys.executable))
|
pass
|
||||||
|
|
||||||
# Upload the package to PyPi.
|
def run(self):
|
||||||
os.system("twine upload dist/*")
|
try:
|
||||||
|
status('Removing previous builds...')
|
||||||
|
rmtree(os.sep.join(('.', 'dist')))
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
status('Building Source and Wheel (universal) distribution...')
|
||||||
|
os.system("{0} setup.py sdist bdist_wheel --universal ".format(sys.executable))
|
||||||
|
|
||||||
|
status('Uploading the package to PyPi via Twine...')
|
||||||
|
os.system("twine upload dist/*")
|
||||||
|
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
# Where the magic happens:
|
# Where the magic happens:
|
||||||
setup(
|
setup(
|
||||||
@ -64,10 +84,13 @@ setup(
|
|||||||
author_email=EMAIL,
|
author_email=EMAIL,
|
||||||
url=URL,
|
url=URL,
|
||||||
packages=find_packages(exclude=('tests',)),
|
packages=find_packages(exclude=('tests',)),
|
||||||
# entry_points={
|
# If your package is a single module, use this instead of 'packages':
|
||||||
# 'console_scripts': ['mycli=mymodule:cli'],
|
# py_modules=['mypackage'],
|
||||||
# },
|
|
||||||
install_requires=required,
|
# entry_points={
|
||||||
|
# 'console_scripts': ['mycli=mymodule:cli'],
|
||||||
|
# },
|
||||||
|
install_requires=REQUIRED,
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
license='ISC',
|
license='ISC',
|
||||||
classifiers=[
|
classifiers=[
|
||||||
@ -85,4 +108,8 @@ setup(
|
|||||||
'Programming Language :: Python :: Implementation :: CPython',
|
'Programming Language :: Python :: Implementation :: CPython',
|
||||||
'Programming Language :: Python :: Implementation :: PyPy'
|
'Programming Language :: Python :: Implementation :: PyPy'
|
||||||
],
|
],
|
||||||
|
# $ setup.py publish support.
|
||||||
|
cmdclass={
|
||||||
|
'publish': PublishCommand,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user