Skip to content

Commit

Permalink
PEP440 support
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-mangin committed Jul 16, 2019
1 parent 40edd3f commit 6a578b8
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class version:
template = """\
import os
commit = "%s"
release = "%s"
json = "%s"
text = "%s"
Expand All @@ -54,8 +55,16 @@ class version:
@staticmethod
def get():
sys.path.append(path.lib_exa)
from version import version
return version
from version import version as release

# transitional fix
if "-" in release:
release = release.split("-")[0]

if version.changelog() != release:
release += ".post1"

return release

@staticmethod
def changelog():
Expand All @@ -70,7 +79,7 @@ def changelog():
def set(tag,commit):
with open(path.version, 'w') as f:
f.write(version.template % (
"%s-%s" % (tag, commit),
commit, tag,
version.JSON,
version.TEXT
))
Expand Down Expand Up @@ -259,7 +268,7 @@ def release_pypi():
return 0


def upload():
def st():
import platform
from distutils.util import get_platform
from setuptools import setup
Expand Down Expand Up @@ -361,6 +370,8 @@ def help():
python3 setup.py cleanup delete left-over file from release
python3 setup.py release tag a new version on github, and update pypi
python3 setup.py pypi create egg/wheel
python3 setup.py install local installation
python3 setup.py build local build
""")

def main ():
Expand All @@ -375,8 +386,18 @@ def main ():

# "internal" commands

if sys.argv[-1] == 'upload':
sys.exit(upload())
if sys.argv[-1] == 'version':
sys.stdout.write("%s\n" % version.get())
sys.exit(0)

if sys.argv[-1] == 'current':
sys.stdout.write("%s\n" % version.changelog())
sys.exit(0)

if '--help' in sys.argv or \
'install' in sys.argv or \
'upload' in sys.argv:
sys.exit(st())

if sys.argv[-1] == 'debian':
release = version.changelog()
Expand Down

0 comments on commit 6a578b8

Please sign in to comment.