diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index c0a5403..19d9ede 100644 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -1,5 +1,3 @@ #!/bin/bash -export CPLUS_INCLUDE_PATH=$PREFIX/include:$CPLUS_INCLUDE_PATH - -${PYTHON} setup.py build -${PYTHON} setup.py install +CPLUS_INCLUDE_PATH=$PREFIX/include:$CPLUS_INCLUDE_PATH ${PYTHON} setup.py build +${PYTHON} setup.py install --single-version-externally-managed --record record.txt diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 2144d3a..b319301 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -1,9 +1,12 @@ +{% set name = "pyodeint" %} +{% set version = "0.6.0.git" %} + package: - name: pyodeint - version: 0.7.0.git + name: {{ name|lower }} + version: {{ version }} source: - path: ../ + git_url: ../ build: number: 0 @@ -15,8 +18,8 @@ requirements: - boost ==1.57.0 - cython run: - - numpy - python + - numpy test: imports: @@ -28,4 +31,11 @@ test: about: home: https://github.com/bjodah/pyodeint - license: Simplified BSD license + license: BSD 2-Clause + license_file: LICENSE + summary: 'Python wrapper around odeint (from the boost C++ library)' + doc_url: https://bjodah.github.io/{{ name }} + +extra: + recipe-maintainers: + - bjodah diff --git a/scripts/generate_docs.sh b/scripts/generate_docs.sh index b4cd5fc..4c43054 100755 --- a/scripts/generate_docs.sh +++ b/scripts/generate_docs.sh @@ -6,15 +6,20 @@ # # Usage if doc/ is actually published in master branch on github: # -# $ ./scripts/generate_docs.sh my_github_username my_github_repo master +# $ ./scripts/generate_docs.sh GITHUB_USERNAME GITHUB_REPO master # NARGS=$# PKG=$(find . -maxdepth 2 -name __init__.py -print0 | xargs -0 -n1 dirname | xargs basename) AUTHOR=$(head -n 1 AUTHORS) python3 -m pip install .[docs] -sphinx-apidoc --full --force -A "$AUTHOR" --module-first --doc-version=$(python setup.py --version) -F -o doc $PKG/ $PKG/tests/ +sphinx-apidoc --full --force -A "$AUTHOR" --module-first --doc-version=$(python setup.py --version) -F -o doc $PKG/ $(find . -type d -name tests) #sed -i 's/Contents/.. include:: ..\/README.rst\n\nContents/g' doc/index.rst -echo ".. include:: ../README.rst" >>doc/index.rst +#echo ".. include:: ../README.rst" >>doc/index.rst +cat <>doc/index.rst +Overview +======== +$(tail -n+3 README.rst) +EOF sed -i "s/'sphinx.ext.viewcode',/'sphinx.ext.viewcode',\n 'sphinx.ext.autosummary',\n 'numpydoc',/g" doc/conf.py sed -i "s/alabaster/sphinx_rtd_theme/g" doc/conf.py if [[ $NARGS -eq 3 ]]; then @@ -36,4 +41,7 @@ EOF fi echo "numpydoc_class_members_toctree = False" >>doc/conf.py ABS_REPO_PATH=$(unset CDPATH && cd "$(dirname "$0")/.." && echo $PWD) -( cd doc; PYTHONPATH=$ABS_REPO_PATH make html ) +if [[ ! -d doc/_build/html ]]; then + mkdir doc/_build/html +fi +( cd doc; PYTHONPATH=$ABS_REPO_PATH make html >_build/html/build.log ) diff --git a/scripts/post_release.sh b/scripts/post_release.sh new file mode 100755 index 0000000..dbdbc78 --- /dev/null +++ b/scripts/post_release.sh @@ -0,0 +1,36 @@ +#!/bin/bash -xeu +# Usage: +# +# $ ./scripts/post_release.sh v1.2.3 myserver githubuser +# +VERSION=${1#v} +SERVER=$2 +GITHUBUSER=$3 +PKG=$(find . -maxdepth 2 -name __init__.py -print0 | xargs -0 -n1 dirname | xargs basename) +PKG_UPPER=$(echo $PKG | tr '[:lower:]' '[:upper:]') +SDIST_FILE=dist/${PKG}-$VERSION.tar.gz +if [[ ! -f "$SDIST_FILE" ]]; then + >&2 echo "Nonexistent file $SDIST_FILE" + exit 1 +fi +SHA256=$(openssl sha256 "$SDIST_FILE" | cut -f2 -d' ') +if [[ -d "dist/conda-recipe-$VERSION" ]]; then + rm -r "dist/conda-recipe-$VERSION" +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 "/cython/d" \ + dist/conda-recipe-$VERSION/meta.yaml + +./scripts/update-gh-pages.sh v$VERSION + +# Specific for this project: +scp -r dist/conda-recipe-$VERSION/ $PKG@$SERVER:~/public_html/conda-recipes/ +scp "$SDIST_FILE" "$PKG@$SERVER:~/public_html/releases/" +for CONDA_PY in 2.7 3.4 3.5; do + for CONDA_NPY in 1.11; do + ssh $PKG@$SERVER "source /etc/profile; conda-build --python $CONDA_PY --numpy $CONDA_NPY ~/public_html/conda-recipes/conda-recipe-$VERSION/" + done +done diff --git a/scripts/release.sh b/scripts/release.sh index d122bbb..8709d11 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,50 +1,47 @@ #!/bin/bash -xeu # Usage: # -# $ ./scripts/release.sh v1.2.3 ~/anaconda2/bin myserver.example.com +# $ ./scripts/release.sh v1.2.3 ~/anaconda2/bin myserver.example.com GITHUB_USER GITHUB_REPO # if [[ $1 != v* ]]; then - >&2 echo "Argument does not start with 'v'" + echo "Argument does not start with 'v'" exit 1 fi -./scripts/check_clean_repo_on_master.sh $1 VERSION=${1#v} CONDA_PATH=$2 SERVER=$3 +find . -type f -iname "*.pyc" -exec rm {} + +find . -type f -iname "*.o" -exec rm {} + +find . -type f -iname "*.so" -exec rm {} + +find . -type d -name "__pycache__" -exec rmdir {} + +./scripts/check_clean_repo_on_master.sh cd $(dirname $0)/.. # PKG will be name of the directory one level up containing "__init__.py" PKG=$(find . -maxdepth 2 -name __init__.py -print0 | xargs -0 -n1 dirname | xargs basename) +! grep --include "*.py" "will_be_missing_in='$VERSION'" -R $PKG/ # see deprecation() PKG_UPPER=$(echo $PKG | tr '[:lower:]' '[:upper:]') ./scripts/run_tests.sh -env ${PKG_UPPER}_RELEASE_VERSION=$1 python setup.py sdist +env ${PKG_UPPER}_RELEASE_VERSION=v$VERSION python setup.py sdist +env ${PKG_UPPER}_RELEASE_VERSION=v$VERSION ./scripts/generate_docs.sh $4 $5 v$VERSION for CONDA_PY in 2.7 3.4 3.5; do for CONDA_NPY in 1.11; do - PATH=$CONDA_PATH:$PATH ./scripts/build_conda_recipe.sh $1 --python $CONDA_PY --numpy $CONDA_NPY + continue # we build the conda recipe on another host for now.. + PATH=$CONDA_PATH:$PATH ./scripts/build_conda_recipe.sh v$VERSION --python $CONDA_PY --numpy $CONDA_NPY done done -# All went well -git tag -a $1 -m $1 +# All went well, add a tag and push it. +git tag -a v$VERSION -m v$VERSION git push git push --tags twine upload dist/${PKG}-$VERSION.tar.gz -MD5=$(md5sum dist/${PKG}-$VERSION.tar.gz | cut -f1 -d' ') -if [[ -d dist/conda-recipe-$VERSION ]]; then - rm -r dist/conda-recipe-$VERSION -fi -cp -r conda-recipe/ dist/conda-recipe-$VERSION -sed -i -E \ - -e "s/version:(.+)/version: $VERSION/" \ - -e "s/path:(.+)/fn: $PKG-$VERSION.tar.gz\n url: https:\/\/pypi.python.org\/packages\/source\/${PKG:0:1}\/$PKG\/$PKG-$VERSION.tar.gz#md5=$MD5\n md5: $MD5/" \ - -e '/cython/d' dist/conda-recipe-$VERSION/meta.yaml - -# Specific for this project: -scp -r dist/conda-recipe-$VERSION/ $PKG@$SERVER:~/public_html/conda-recipes/ -scp dist/${PKG}-$VERSION.tar.gz $PKG@$SERVER:~/public_html/releases/ -for CONDA_PY in 2.7 3.4 3.5; do - for CONDA_NPY in 1.11; do - ssh $PKG@$SERVER "source /etc/profile; conda-build --python $CONDA_PY --numpy $CONDA_NPY ~/public_html/conda-recipes/conda-recipe-$VERSION/" - done -done +set +x +echo "" +echo " You may now create a new github release with the tag \"v$VERSION\" and name " +echo " it \"${PKG}-${VERSION}\", (don't foreget to manually attach the new .tar.gz" +echo " file from the ./dist/ directory). Then run:" +echo "" +echo " $ ./scripts/post_release.sh $1 MYSERVER MYGITHUBUSERNAME" +echo ""