diff options
author | JensDiemer <git@jensdiemer.de> | 2018-02-27 18:17:12 +0100 |
---|---|---|
committer | JensDiemer <git@jensdiemer.de> | 2018-02-27 18:17:12 +0100 |
commit | 29049da579a54b814690e0a0a61d1f27f6bb8b0b (patch) | |
tree | 4ab661a87fd875dc43a0b4ea04290a3f83de83b0 | |
parent | b7b3f64907125347071fd9af52763928ca2dd666 (diff) | |
download | creole-29049da579a54b814690e0a0a61d1f27f6bb8b0b.tar.gz |
update setup.pyv1.3.2
-rwxr-xr-x | setup.py | 82 |
1 files changed, 62 insertions, 20 deletions
@@ -5,7 +5,7 @@ distutils setup ~~~~~~~~~~~~~~~ - :copyleft: 2009-2015 by the python-creole team, see AUTHORS for more details. + :copyleft: 2009-2018 by the python-creole team, see AUTHORS for more details. :license: GNU GPL v3 or above, see LICENSE for more details. """ @@ -18,12 +18,28 @@ import shutil from setuptools import setup, find_packages, Command -from creole import __version__ -from creole.setup_utils import get_long_description - +try: + from creole import __version__ +except ImportError: + __version__ = "<unknown>" PACKAGE_ROOT = os.path.dirname(os.path.abspath(__file__)) +#_____________________________________________________________________________ +# convert creole to ReSt on-the-fly, see also: +# https://github.com/jedie/python-creole/wiki/Use-In-Setup +long_description = None +for arg in ("test", "check", "register", "sdist", "--long-description"): + if arg in sys.argv: + try: + from creole.setup_utils import get_long_description + except ImportError as err: + raise ImportError("%s - Please install python-creole - e.g.: pip install python-creole" % err) + else: + long_description = get_long_description(PACKAGE_ROOT) + break +#---------------------------------------------------------------------------- + if "test" in sys.argv or "nosetests" in sys.argv: """ @@ -77,31 +93,35 @@ if "publish" in sys.argv: TODO: Look at: https://github.com/zestsoftware/zest.releaser Source: https://github.com/jedie/python-code-snippets/blob/master/CodeSnippets/setup_publish.py - copyleft 2015 Jens Diemer - GNU GPL v2+ + copyleft 2015-2017 Jens Diemer - GNU GPL v2+ """ if sys.version_info[0] == 2: input = raw_input + import_error = False try: # Test if wheel is installed, otherwise the user will only see: # error: invalid command 'bdist_wheel' import wheel except ImportError as err: print("\nError: %s" % err) - print("\nMaybe https://pypi.python.org/pypi/wheel is not installed or virtualenv not activated?!?") + print("\nMaybe https://pypi.org/project/wheel is not installed or virtualenv not activated?!?") print("e.g.:") print(" ~/your/env/$ source bin/activate") print(" ~/your/env/$ pip install wheel") - sys.exit(-1) + import_error = True try: import twine except ImportError as err: print("\nError: %s" % err) - print("\nMaybe https://pypi.python.org/pypi/twine is not installed or virtualenv not activated?!?") + print("\nMaybe https://pypi.org/project/twine is not installed or virtualenv not activated?!?") print("e.g.:") print(" ~/your/env/$ source bin/activate") print(" ~/your/env/$ pip install twine") + import_error = True + + if import_error: sys.exit(-1) def verbose_check_output(*args): @@ -120,9 +140,14 @@ if "publish" in sys.argv: print("\tCall: %r\n" % " ".join(args)) subprocess.check_call(args, universal_newlines=True) + def confirm(txt): + print("\n%s" % txt) + if input("\nPublish anyhow? (Y/N)").lower() not in ("y", "j"): + print("Bye.") + sys.exit(-1) + if "dev" in __version__: - print("\nERROR: Version contains 'dev': v%s\n" % __version__) - sys.exit(-1) + confirm("WARNING: Version contains 'dev': v%s\n" % __version__) print("\nCheck if we are on 'master' branch:") call_info, output = verbose_check_output("git", "branch", "--no-color") @@ -130,11 +155,7 @@ if "publish" in sys.argv: if "* master" in output: print("OK") else: - print("\nNOTE: It seems you are not on 'master':") - print(output) - if input("\nPublish anyhow? (Y/N)").lower() not in ("y", "j"): - print("Bye.") - sys.exit(-1) + confirm("\nNOTE: It seems you are not on 'master':\n%s" % output) print("\ncheck if if git repro is clean:") call_info, output = verbose_check_output("git", "status", "--porcelain") @@ -146,6 +167,14 @@ if "publish" in sys.argv: print(output) sys.exit(-1) + print("\nRun './setup.py check':") + call_info, output = verbose_check_output("./setup.py", "check") + if "warning" in output: + print(output) + confirm("Warning found!") + else: + print("OK") + print("\ncheck if pull is needed") verbose_check_call("git", "fetch", "--all") call_info, output = verbose_check_output("git", "log", "HEAD..origin/master", "--oneline") @@ -179,8 +208,16 @@ if "publish" in sys.argv: log.write(output) print("Build output is in log file: %r" % log_filename) - print("\ngit tag version (will raise a error of tag already exists)") - verbose_check_call("git", "tag", "v%s" % __version__) + git_tag="v%s" % __version__ + + print("\ncheck git tag") + call_info, output = verbose_check_output("git", "log", "HEAD..origin/master", "--oneline") + if git_tag in output: + print("\n *** ERROR: git tag %r already exists!" % git_tag) + print(output) + sys.exit(-1) + else: + print("OK") print("\nUpload with twine:") twine_args = sys.argv[1:] @@ -190,6 +227,9 @@ if "publish" in sys.argv: from twine.commands.upload import main as twine_upload twine_upload(twine_args) + print("\ngit tag version") + verbose_check_call("git", "tag", git_tag) + print("\ngit push tag to server") verbose_check_call("git", "push", "--tags") @@ -200,7 +240,7 @@ setup( name='python-creole', version=__version__, description='python-creole is an open-source (GPL) markup converter in pure Python for: creole2html, html2creole, html2ReSt, html2textile', - long_description=get_long_description(PACKAGE_ROOT), + long_description=long_description, author=get_authors(), author_email="python-creole@jensdiemer.de", maintainer="Jens Diemer", @@ -228,9 +268,11 @@ setup( "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Programming Language :: Python", - "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.2", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: PyPy", "Operating System :: OS Independent", "Topic :: Documentation", |