Skip to content

Commit

Permalink
Fixes for conda-build 3
Browse files Browse the repository at this point in the history
  • Loading branch information
bjodah committed Oct 15, 2018
1 parent 126b1a5 commit 5f0eb62
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
8 changes: 7 additions & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand All @@ -9,6 +14,7 @@ source:
git_url: ../

build:
noarch: python
number: 0
script: python setup.py install --single-version-externally-managed --record record.txt

Expand Down
7 changes: 5 additions & 2 deletions scripts/post_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions scripts/update-gh-pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 2 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]
Expand All @@ -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 = [
Expand Down

0 comments on commit 5f0eb62

Please sign in to comment.