summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJensDiemer <git@jensdiemer.de>2015-08-15 22:28:25 +0200
committerJensDiemer <git@jensdiemer.de>2015-08-15 22:28:25 +0200
commit920e02c33d9ff53ccbb315b3b0bd9b1a61b38caf (patch)
tree636000f73183ede7ff2a1846d091733ec425ffc2
parente26736417250de16072d3c737a1c5ef984cb7d37 (diff)
downloadcreole-1.3.1.tar.gz
Add LICENSE in MANIFEST.in to bugfix setup.py run:v1.3.1
e.g.: https://travis-ci.org/jedie/PyLucid/builds/75760087#L407-L412 + update setup publish code from: https://github.com/jedie/python-code-snippets/blob/master/CodeSnippets/setup_publish.py
-rw-r--r--MANIFEST.in2
-rw-r--r--README.creole2
-rw-r--r--creole/__init__.py14
-rwxr-xr-xsetup.py171
4 files changed, 151 insertions, 38 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index 47c0855..8cefd2c 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,3 +1,3 @@
-include AUTHORS MANIFEST.in README.creole
+include AUTHORS LICENSE MANIFEST.in README.creole
recursive-exclude * *.py[co]
recursive-include * *.creole \ No newline at end of file
diff --git a/README.creole b/README.creole
index aaeab33..4bf1f39 100644
--- a/README.creole
+++ b/README.creole
@@ -174,6 +174,8 @@ Note: In this case you must install **docutils**! See above.
= history =
+* v1.3.1 - 2015-08-15 - [[https://github.com/jedie/python-creole/compare/v1.3.0...v1.3.1|compare v1.3.0...v1.3.1]]
+** Bugfix for "Failed building wheel for python-creole"
* v1.3.0 - 2015-06-02 - [[https://github.com/jedie/python-creole/compare/v1.2.2...v1.3.0|compare v1.2.2...v1.3.0]]
** Refactory internal file structure
** run unittests and doctests with nose
diff --git a/creole/__init__.py b/creole/__init__.py
index 37487c9..6ca2008 100644
--- a/creole/__init__.py
+++ b/creole/__init__.py
@@ -14,16 +14,12 @@
:PyPi:
http://pypi.python.org/pypi/python-creole/
- :copyleft: 2008-2014 by python-creole team, see AUTHORS for more details.
+ :copyleft: 2008-2015 by python-creole team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
from __future__ import division, absolute_import, print_function, unicode_literals
-__version__ = (1, 3, 0)
-__api__ = (1, 0) # Creole 1.0 spec - http://wikicreole.org/
-
-
import warnings
from creole.emitter.creol2html_emitter import HtmlEmitter
@@ -35,11 +31,11 @@ from creole.parser.html_parser import HtmlParser
from creole.py3compat import TEXT_TYPE
-# TODO: Add git date to __version__
-
+__version__ = "1.3.1"
+__api__ = "1.0" # Creole 1.0 spec - http://wikicreole.org/
-VERSION_STRING = '.'.join(str(part) for part in __version__)
-API_STRING = '.'.join(str(integer) for integer in __api__)
+VERSION_STRING = __version__ # remove in future
+API_STRING = __api__ # remove in future
def creole2html(markup_string, debug=False,
diff --git a/setup.py b/setup.py
index 5d33edf..d476633 100755
--- a/setup.py
+++ b/setup.py
@@ -5,47 +5,26 @@
distutils setup
~~~~~~~~~~~~~~~
- :copyleft: 2009-2011 by the python-creole team, see AUTHORS for more details.
+ :copyleft: 2009-2015 by the python-creole team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
from __future__ import division, absolute_import, print_function, unicode_literals
+
import os
import sys
+import subprocess
+import shutil
from setuptools import setup, find_packages, Command
-from creole import VERSION_STRING
+from creole import __version__
from creole.setup_utils import get_long_description
PACKAGE_ROOT = os.path.dirname(os.path.abspath(__file__))
-if "publish" in sys.argv:
- 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("e.g.:")
- print(" ~/your/env/$ source bin/activate")
- print(" ~/your/env/$ pip install wheel")
- sys.exit(-1)
-
- import subprocess
- args = [sys.executable or "python", "setup.py", "sdist", "bdist_wheel", "upload"]
- print("\nCall: %r\n" % " ".join(args))
- subprocess.call(args)
-
- print("\nDon't forget to tag this version, e.g.:")
- print("\tgit tag v%s" % VERSION_STRING)
- print("\tgit push --tags")
- sys.exit()
-
-
if "test" in sys.argv or "nosetests" in sys.argv:
"""
nose is a optional dependency, so test import.
@@ -80,9 +59,146 @@ def get_authors():
return authors
+if "publish" in sys.argv:
+ """
+ 'publish' helper for setup.py
+
+ Build and upload to PyPi, if...
+ ... __version__ doesn't contains "dev"
+ ... we are on git 'master' branch
+ ... git repository is 'clean' (no changed files)
+
+ Upload with "twine", git tag the current version and git push --tag
+
+ The cli arguments will be pass to 'twine'. So this is possible:
+ * Display 'twine' help page...: ./setup.py publish --help
+ * use testpypi................: ./setup.py publish --repository=test
+
+ 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+
+ """
+ if sys.version_info[0] == 2:
+ input = raw_input
+
+ 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("e.g.:")
+ print(" ~/your/env/$ source bin/activate")
+ print(" ~/your/env/$ pip install wheel")
+ sys.exit(-1)
+
+ 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("e.g.:")
+ print(" ~/your/env/$ source bin/activate")
+ print(" ~/your/env/$ pip install twine")
+ sys.exit(-1)
+
+ def verbose_check_output(*args):
+ """ 'verbose' version of subprocess.check_output() """
+ call_info = "Call: %r" % " ".join(args)
+ try:
+ output = subprocess.check_output(args, universal_newlines=True, stderr=subprocess.STDOUT)
+ except subprocess.CalledProcessError as err:
+ print("\n***ERROR:")
+ print(err.output)
+ raise
+ return call_info, output
+
+ def verbose_check_call(*args):
+ """ 'verbose' version of subprocess.check_call() """
+ print("\tCall: %r\n" % " ".join(args))
+ subprocess.check_call(args, universal_newlines=True)
+
+ if "dev" in __version__:
+ print("\nERROR: Version contains 'dev': v%s\n" % __version__)
+ sys.exit(-1)
+
+ print("\nCheck if we are on 'master' branch:")
+ call_info, output = verbose_check_output("git", "branch", "--no-color")
+ print("\t%s" % call_info)
+ 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)
+
+ print("\ncheck if if git repro is clean:")
+ call_info, output = verbose_check_output("git", "status", "--porcelain")
+ print("\t%s" % call_info)
+ if output == "":
+ print("OK")
+ else:
+ print("\n *** ERROR: git repro not clean:")
+ print(output)
+ sys.exit(-1)
+
+ print("\ncheck if pull is needed")
+ verbose_check_call("git", "fetch", "--all")
+ call_info, output = verbose_check_output("git", "log", "HEAD..origin/master", "--oneline")
+ print("\t%s" % call_info)
+ if output == "":
+ print("OK")
+ else:
+ print("\n *** ERROR: git repro is not up-to-date:")
+ print(output)
+ sys.exit(-1)
+ verbose_check_call("git", "push")
+
+ print("\nCleanup old builds:")
+ def rmtree(path):
+ path = os.path.abspath(path)
+ if os.path.isdir(path):
+ print("\tremove tree:", path)
+ shutil.rmtree(path)
+ rmtree("./dist")
+ rmtree("./build")
+
+ print("\nbuild but don't upload...")
+ log_filename="build.log"
+ with open(log_filename, "a") as log:
+ call_info, output = verbose_check_output(
+ sys.executable or "python",
+ "setup.py", "sdist", "bdist_wheel", "bdist_egg"
+ )
+ print("\t%s" % call_info)
+ log.write(call_info)
+ 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__)
+
+ print("\nUpload with twine:")
+ twine_args = sys.argv[1:]
+ twine_args.remove("publish")
+ twine_args.insert(1, "dist/*")
+ print("\ttwine upload command args: %r" % " ".join(twine_args))
+ from twine.commands.upload import main as twine_upload
+ twine_upload(twine_args)
+
+ print("\ngit push tag to server")
+ verbose_check_call("git", "push", "--tags")
+
+ sys.exit(0)
+
+
setup(
name='python-creole',
- version=VERSION_STRING,
+ 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),
author=get_authors(),
@@ -107,7 +223,6 @@ setup(
keywords="creole markup creole2html html2creole rest2html html2rest html2textile",
classifiers=[
# http://pypi.python.org/pypi?%3Aaction=list_classifiers
-# "Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Intended Audience :: Developers",