From 5f0eb6263c936c75e8f00b43644d88a04356723e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Dahlgren?= Date: Mon, 15 Oct 2018 12:18:58 +0200 Subject: [PATCH] Fixes for conda-build 3 --- conda-recipe/meta.yaml | 8 +++++++- scripts/post_release.sh | 7 +++++-- scripts/update-gh-pages.sh | 3 +++ setup.py | 12 ++---------- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index ad0c501..5a5992c 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -1,5 +1,10 @@ {% set name = "pycompilation" %} -{% set version = "0.5.0.dev0+git" %} +{% set version = GIT_DESCRIBE_TAG | replace("v", "") %} +{% set number = GIT_DESCRIBE_NUMBER | int %} +{% if number > 0 %} + {% set version = version + ".post" + GIT_DESCRIBE_NUMBER %} +{% endif %} + package: name: {{ name|lower }} @@ -9,6 +14,7 @@ source: git_url: ../ build: + noarch: python number: 0 script: python setup.py install --single-version-externally-managed --record record.txt diff --git a/scripts/post_release.sh b/scripts/post_release.sh index 30d9b06..42770df 100755 --- a/scripts/post_release.sh +++ b/scripts/post_release.sh @@ -19,8 +19,11 @@ if [[ -d "dist/conda-recipe-$VERSION" ]]; then fi cp -r conda-recipe/ dist/conda-recipe-$VERSION sed -i -E \ - -e "s/\{\% set version(.+)/\{\% set version = \"$VERSION\" \%\}\n\{\% set sha256 = \"$SHA256\" \%\}/" \ - -e "s/git_url:(.+)/fn: \{\{ name \}\}-\{\{ version \}\}.tar.gz\n url: https:\/\/pypi.io\/packages\/source\/\{\{ name\[0\] \}\}\/\{\{ name \}\}\/\{\{ name \}\}-\{\{ version \}\}.tar.gz\n sha256: \{\{ sha256 \}\}/" \ + -e "s/git_url:(.+)/fn: \{\{ name \}\}-\{\{ version \}\}.tar.gz\n url: https:\/\/pypi.io\/packages\/source\/\{\{ name\[0\] \}\}\/\{\{ name \}\}\/\{\{ name \}\}-\{\{ version \}\}.tar.gz\n sha256: \"$SHA256\"/" \ + -e "/set version/d" \ + -e "/set number/d" \ + -e "/if number/d" \ + -e "s/.*endif*./\{% set version = \"$VERSION\" /" \ dist/conda-recipe-$VERSION/meta.yaml ./scripts/update-gh-pages.sh v$VERSION diff --git a/scripts/update-gh-pages.sh b/scripts/update-gh-pages.sh index fc9563e..15b320b 100755 --- a/scripts/update-gh-pages.sh +++ b/scripts/update-gh-pages.sh @@ -51,6 +51,9 @@ if [[ -d $tmpdir/.gh-pages-skeleton ]]; then cp -r $tmpdir/.gh-pages-skeleton/. . fi if [[ "$tag" == v* ]]; then + if [[ -L latest ]]; then + rm latest + fi ln -s $tag latest commit_msg="Release docs for $tag" else diff --git a/setup.py b/setup.py index 3e6ffdc..cdea157 100644 --- a/setup.py +++ b/setup.py @@ -24,15 +24,6 @@ def _path_under_setup(*args): _version_env_var = '%s_RELEASE_VERSION' % pkg_name.upper() RELEASE_VERSION = os.environ.get(_version_env_var, '') -# http://conda.pydata.org/docs/build.html#environment-variables-set-during-the-build-process -CONDA_BUILD = os.environ.get('CONDA_BUILD', '0') == '1' -if CONDA_BUILD: - try: - RELEASE_VERSION = 'v' + open( - '__conda_version__.txt', 'rt').readline().rstrip() - except IOError: - pass - if len(RELEASE_VERSION) > 1 and RELEASE_VERSION[0] == 'v': TAGGED_RELEASE = True __version__ = RELEASE_VERSION[1:] @@ -49,7 +40,8 @@ def _path_under_setup(*args): else: if 'develop' not in sys.argv: warnings.warn("Using git to derive version: dev-branches may compete.") - __version__ = re.sub('v([0-9.]+)-(\d+)-(\w+)', r'\1.post\2+\3', _git_version) # .dev < '' < .post + _ver_tmplt = r'\1.post\2' if os.environ.get('CONDA_BUILD', '0') == '1' else r'\1.post\2+\3' + __version__ = re.sub('v([0-9.]+)-(\d+)-(\S+)', _ver_tmplt, _git_version) # .dev < '' < .post tests = [