Update setup.py

This commit is contained in:
Kenneth Reitz 2017-08-28 22:39:54 -04:00 committed by GitHub
parent 0c572e5324
commit bbb281284d

View File

@ -1,11 +1,15 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Note: To use the 'upload' functionality of this file, you must:
# $ pip install twine
import codecs
import os
import sys
from setuptools import find_packages, setup
from shutil import rmtree
# Package meta-data.
NAME = 'mypackage'
@ -36,8 +40,19 @@ required = [
# Support "$ setup.py publish".
if sys.argv[-1] == "publish":
os.system("{0} setup.py sdist bdist_wheel upload".format(sys.executable))
sys.exit()
try:
# Remove previous builds from the source tree.
rmtree(os.sep.join(('.', 'dist')))
except FileNotFoundError:
pass
# Create Source and Wheel (universal) distributions
os.system("{0} setup.py sdist bdist_wheel --universal ".format(sys.executable))
# Upload the package to PyPi.
os.system("twine upload dist/*")
sys.exit()
# Where the magic happens:
setup(