diff --git a/.travis.yml b/.travis.yml index 5cc833b73..df28fa016 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: python -matrix: +jobs: include: - name: Bionic python 3.7 os: linux @@ -61,6 +61,12 @@ install: - export VERSION=$(echo $REV | tr - .) - echo $REV - pip install -e ".[dev]" +- export IS_MASTER=$(git ls-remote origin | grep "$TRAVIS_COMMIT\s\+refs/heads/master$" | grep -o "master") +- export IS_DEPLOY=$(git ls-remote origin | grep "$TRAVIS_COMMIT\s\+refs/heads/deploy-test$" | grep -o "deploy-test") +- echo $TRAVIS_COMMIT +- echo $IS_MASTER +- echo $IS_DEPLOY + script: - cd $HOME - nosetests tofu.tests --nocapture -v --with-id --with-timer --with-coverage --cover-package=tofu @@ -76,55 +82,51 @@ before_deploy: echo "BEFORE DEPLOY START........" ls $START cd $START - conda config --set anaconda_upload no - conda install anaconda-client conda-build - conda build conda_recipe - export PKG_REAL=$(conda build . --output | tail -1) echo "BEFORE DEPLOY END.........." fi deploy: - provider: pypi distributions: sdist - user: __token__ + username: __token__ skip_existing: true skip_cleanup: true on: - branch: deploy-test tags: true + condition: $IS_DEPLOY = "deploy-test" server: https://test.pypi.org/legacy/ password: secure: xfVFuoz9YYNChzmT8DC9y+8eH6zdFkfoy3B51uqy8b+vhJNzCzLay4F0uSHvhHy6iYorM6UQKr6soC4D7n3PhmnFOTX/cgLtd/p4gBWGYZF6yXacvw+UHKMshgbAhn2sEynxdSAqdAlNttMI8jsUu9RhbzGiv1l5zSNnFWF4Zsly02G68UnztxIGoz8AYTRW2N2oQhGrl/ryj/YG4mSRKjled6BzK7kNoJUqLGl12DqdMMTEmdJ9NHBXgK3Dv0ya17ReFz3TcxE/4+Yc38NwSR4Ia2EvVSMtyIaccQ1uSrXwW8JQOMn+9CmDWZVUMDD2bzKYbm2WGGM9Fh8WrHnwlWRujoLDofhYEK0Cus11gULFF+J88XucOJlyJNrHP6TWxdSVVoQfwWr2ABqZIvilsvHpF+sjDLqomTNHdi+BbzP2koRv0nJb9K1W24bjPLtSK8+plX7suv7gdBNwlsJ+dPLDM87v4+jGHGthQ6P4X2guTMHZm1PU0PSPB9LCbENCN1uktLLhkgx7gZ42Ag+Jwiu02ENkChLaEB4WpPb9mjLnomu5LDYXFGtPJ/uLMOi3VCXyda0LrzqDhXYT3Cg4hvXySwJcgMYSXalfTxnTm9oouePiEXDbK+XwjMP9mjC5CeMg3SaFFTywqaTH0WUqiOBUJ6H3Gsm0sB15Tj4lNKQ= - provider: pypi distributions: bdist_wheel - user: __token__ + username: __token__ skip_existing: true skip_cleanup: true on: - branch: deploy-test - condition: $OS = osx-64 tags: true + condition: $IS_DEPLOY = "deploy-test" + condition: $OS = osx-64 server: https://test.pypi.org/legacy/ password: secure: xfVFuoz9YYNChzmT8DC9y+8eH6zdFkfoy3B51uqy8b+vhJNzCzLay4F0uSHvhHy6iYorM6UQKr6soC4D7n3PhmnFOTX/cgLtd/p4gBWGYZF6yXacvw+UHKMshgbAhn2sEynxdSAqdAlNttMI8jsUu9RhbzGiv1l5zSNnFWF4Zsly02G68UnztxIGoz8AYTRW2N2oQhGrl/ryj/YG4mSRKjled6BzK7kNoJUqLGl12DqdMMTEmdJ9NHBXgK3Dv0ya17ReFz3TcxE/4+Yc38NwSR4Ia2EvVSMtyIaccQ1uSrXwW8JQOMn+9CmDWZVUMDD2bzKYbm2WGGM9Fh8WrHnwlWRujoLDofhYEK0Cus11gULFF+J88XucOJlyJNrHP6TWxdSVVoQfwWr2ABqZIvilsvHpF+sjDLqomTNHdi+BbzP2koRv0nJb9K1W24bjPLtSK8+plX7suv7gdBNwlsJ+dPLDM87v4+jGHGthQ6P4X2guTMHZm1PU0PSPB9LCbENCN1uktLLhkgx7gZ42Ag+Jwiu02ENkChLaEB4WpPb9mjLnomu5LDYXFGtPJ/uLMOi3VCXyda0LrzqDhXYT3Cg4hvXySwJcgMYSXalfTxnTm9oouePiEXDbK+XwjMP9mjC5CeMg3SaFFTywqaTH0WUqiOBUJ6H3Gsm0sB15Tj4lNKQ= - provider: pypi distributions: sdist - user: "Didou09" + username: "Didou09" skip_existing: true skip_cleanup: true on: tags: true - branch: master + condition: $IS_MASTER = "master" password: secure: JNEDTDJVx/2fXNfHntNQ99iDRNuQ4uB3y+DBWVIBycCT95+UCb36YPtKzmruEk/UUS29Xgq4IYCGdfCSWE9smKqG8tV1PcHiw705m+AzcpKy77YtzbVECFBxqY4W36O2pHrkwEUzP/7acjFwNsnUFzArqEzsBJ+KdLaa4OPHJXCh30GA0GyqlrXYbBKG+DA9hX5vtsGo4C6w9noALYF3fS7pKPiI6ipKFnAlzGgHQ7Ke0uQME8N3IAFhmh+Z5xMtIIDWxlnqv+KszdG4DIaGV/W6NIJNAbRhzkqUd+Chu6LoPAd/XkHDTeirR/MBkNUc5UcRJxRnP9rUTRo1gCO/buTYuNRgFkMvqhV5a033+x9edWgtUiKNJIMPLXOxe0RJvc5GWji+Co77HtHxRmGRM2rnYqWMtZeYZlFbUdvHu/8jf0d6I8jyUgAoJYdlMA2u/ipENP3S6by4epE9qycUPXiIVh6r3DZbf3vPTMFvTZYAjBrA0NOzihv1xgcXwemmNUFOQSpe0io4UcFxtS9lLMo+30UMQjCHSnbEVM3zSlZmbMOKpkVOlKlt8Lz5NxwVgWtu9FuW2pGukLtE8AWbqvY9urXAPZCQqZlOIklIjJQIqOITnuw9LEV09cgvPHXfdvNni3ldbMlIQ89zryM6dYvhYryTiEZGK4JDR3wAKJA= - provider: pypi distributions: bdist_wheel - user: "Didou09" + username: "Didou09" skip_existing: true skip_cleanup: true on: condition: $OS = osx-64 tags: true - branch: master + condition: $IS_MASTER = "master" password: secure: JNEDTDJVx/2fXNfHntNQ99iDRNuQ4uB3y+DBWVIBycCT95+UCb36YPtKzmruEk/UUS29Xgq4IYCGdfCSWE9smKqG8tV1PcHiw705m+AzcpKy77YtzbVECFBxqY4W36O2pHrkwEUzP/7acjFwNsnUFzArqEzsBJ+KdLaa4OPHJXCh30GA0GyqlrXYbBKG+DA9hX5vtsGo4C6w9noALYF3fS7pKPiI6ipKFnAlzGgHQ7Ke0uQME8N3IAFhmh+Z5xMtIIDWxlnqv+KszdG4DIaGV/W6NIJNAbRhzkqUd+Chu6LoPAd/XkHDTeirR/MBkNUc5UcRJxRnP9rUTRo1gCO/buTYuNRgFkMvqhV5a033+x9edWgtUiKNJIMPLXOxe0RJvc5GWji+Co77HtHxRmGRM2rnYqWMtZeYZlFbUdvHu/8jf0d6I8jyUgAoJYdlMA2u/ipENP3S6by4epE9qycUPXiIVh6r3DZbf3vPTMFvTZYAjBrA0NOzihv1xgcXwemmNUFOQSpe0io4UcFxtS9lLMo+30UMQjCHSnbEVM3zSlZmbMOKpkVOlKlt8Lz5NxwVgWtu9FuW2pGukLtE8AWbqvY9urXAPZCQqZlOIklIjJQIqOITnuw9LEV09cgvPHXfdvNni3ldbMlIQ89zryM6dYvhYryTiEZGK4JDR3wAKJA= - provider: script @@ -132,5 +134,4 @@ deploy: skip_cleanup: true on: tags: true - branch: master - skip_cleanup: true + condition: $IS_MASTER = "master" diff --git a/anaconda_upload.sh b/anaconda_upload.sh index e0f5a9a66..c5d368920 100644 --- a/anaconda_upload.sh +++ b/anaconda_upload.sh @@ -1,8 +1,11 @@ #!/bin/bash set -e -#echo "Converting conda package..." -#conda convert --platform all $PKG_DIR/tofu-*.tar.bz2 --output-dir $PKG_DIR +conda config --set anaconda_upload no +conda install anaconda-client conda-build +conda build conda_recipe +export PKG_REAL=$(conda build . --output | tail -1) +echo $PKG_REAL echo "Deploying to anaconda.org..." export USER=ToFuProject diff --git a/pyproject.toml b/pyproject.toml index 914ec2419..daf04b8b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,6 @@ [build-system] -requires = ["setuptools>=40.8.0", "wheel", "cython>0.26", "numpy"] -build-backend = "setuptools.build_meta" \ No newline at end of file +requires = ["setuptools>=40.8.0", + "wheel", + "cython>0.26", + "numpy", + ] diff --git a/setup.py b/setup.py index 443fdd0f2..557b746fe 100644 --- a/setup.py +++ b/setup.py @@ -16,11 +16,8 @@ # ... packages that need to be in pyproject.toml from Cython.Distutils import build_ext import numpy as np -# ... -# Remove _updateversion import due to build-time dependency -# => updateversion defined in here for commodity -# => find a cleaner solution later -# import _updateversion as up +# ... local script +import _updateversion as up # ... for `clean` command from distutils.command.clean import clean as Clean @@ -149,25 +146,6 @@ def check_for_openmp(cc_var): _HERE = os.path.abspath(os.path.dirname(__file__)) -def updateversion(path=_HERE): - # Fetch version from git tags, and write to version.py - # Also, when git is not available (PyPi package), use stored version.py - version_py = os.path.join(path, 'tofu', 'version.py') - try: - version_git = subprocess.check_output(["git", - "describe"]).rstrip().decode() - except subprocess.CalledProcessError: - with open(version_py, 'r') as fh: - version_git = fh.read().strip().split("=")[-1].replace("'", '') - version_git = version_git.lower().replace('v', '') - - version_msg = "# Do not edit, pipeline versioning governed by git tags!" - with open(version_py, "w") as fh: - msg = "{0}__version__ = '{1}'{0}".format(os.linesep, version_git) - fh.write(version_msg + msg) - return version_git - - def get_version_tofu(path=_HERE): # Try from git @@ -186,8 +164,9 @@ def get_version_tofu(path=_HERE): .rstrip() .decode() ) - if git_branch in ["master", "deploy-test"]: - version_tofu = updateversion() + deploy_branches = ["master", "deploy-test"] + if (git_branch in deploy_branches or "TRAVIS_TAG" in os.environ): + version_tofu = up.updateversion() else: isgit = False except Exception: diff --git a/tofu/version.py b/tofu/version.py index fbadd4a44..6c45f826f 100644 --- a/tofu/version.py +++ b/tofu/version.py @@ -1,2 +1,2 @@ # Do not edit, pipeline versioning governed by git tags! -__version__ = '1.4.2' +__version__ = '1.4.2b3-13-gd916732c'