From b40523192ed3f9918c26ad8595923f91cf0d440f Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 23 Oct 2017 21:56:40 +0100 Subject: [PATCH] :egg: :ferris_wheel: release 0.0.2, that won't need gease for the end user --- CHANGELOG.rst | 7 +++++++ README.rst | 4 ++-- setup.py | 38 ++++++++++++++++++++++++++++++-------- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 56c53d4..3ca9e25 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,13 @@ Change log =========== +0.0.2 - 23.10.2017 +-------------------------------------------------------------------------------- + +#. pyexcel `#105 `_, remove gease + from setup_requires, introduced by 0.1.3. + + 0.0.1 - unreleased -------------------------------------------------------------------------------- diff --git a/README.rst b/README.rst index 61a23dd..ef1a0c5 100644 --- a/README.rst +++ b/README.rst @@ -23,7 +23,7 @@ Installation ================================================================================ -You can install it via pip: +You can install brython-pack via pip: .. code-block:: bash @@ -34,7 +34,7 @@ or clone it and install it: .. code-block:: bash - $ git clone http://github.com/chfw/brython-pack.git + $ git clone https://github.com/chfw/brython-pack.git $ cd brython-pack $ python setup.py install diff --git a/setup.py b/setup.py index 85093e3..36fcd36 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,9 @@ # Template by setupmobans import os +import sys import codecs from shutil import rmtree from setuptools import setup, find_packages, Command -import sys PY2 = sys.version_info[0] == 2 PY26 = PY2 and sys.version_info[1] < 7 @@ -48,11 +48,15 @@ PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests']) EXTRAS_REQUIRE = {} +# You do not need to read beyond this line PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi'.format( sys.executable) GS_COMMAND = ('gs brython-pack v0.0.1 ' + "Find 0.0.1 in changelog for more details") -here = os.path.abspath(os.path.dirname(__file__)) +NO_GS_MESSAGE = ('Automatic github release is disabled. ' + + 'Please install gease to enable it.') +UPLOAD_FAILED_MSG = ('Upload failed. please run "%s" yourself.') +HERE = os.path.abspath(os.path.dirname(__file__)) class PublishCommand(Command): @@ -74,18 +78,37 @@ def finalize_options(self): def run(self): try: - self.status('Removing previous builds…') - rmtree(os.path.join(here, 'dist')) + self.status('Removing previous builds...') + rmtree(os.path.join(HERE, 'dist')) except OSError: pass - self.status('Building Source and Wheel (universal) distribution…') - if os.system(GS_COMMAND) == 0: - os.system(PUBLISH_COMMAND) + self.status('Building Source and Wheel (universal) distribution...') + run_status = True + if has_gease(): + run_status = os.system(GS_COMMAND) == 0 + else: + self.status(NO_GS_MESSAGE) + if run_status: + if os.system(PUBLISH_COMMAND) != 0: + self.status(UPLOAD_FAILED_MSG % PUBLISH_COMMAND) sys.exit() +def has_gease(): + """ + test if github release command is installed + + visit http://github.com/moremoban/gease for more info + """ + try: + import gease # noqa + return True + except ImportError: + return False + + def read_files(*files): """Read files into setup""" text = "" @@ -147,7 +170,6 @@ def filter_out_test_code(file_handle): zip_safe=False, entry_points=ENTRY_POINTS, classifiers=CLASSIFIERS, - setup_requires=['gease'], cmdclass={ 'publish': PublishCommand, }