From 7511355c6b5534ea73d6bfe6561ce700cccad1ca Mon Sep 17 00:00:00 2001 From: Ivan Date: Thu, 23 Aug 2018 11:59:21 -0400 Subject: [PATCH] Added packaging for xndtools (#18) --- .appveyor_conda.yml | 6 ++++++ .gitignore | 1 + .travis.yml | 6 ++++++ scripts/conda-install.bat | 6 +++++- scripts/conda-install.sh | 4 ++++ setup.py | 21 ++++++++++++++++----- 6 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 .gitignore diff --git a/.appveyor_conda.yml b/.appveyor_conda.yml index 7d2ed51..167461a 100644 --- a/.appveyor_conda.yml +++ b/.appveyor_conda.yml @@ -17,6 +17,7 @@ build_script: - git clone https://github.com/plures/ndtypes.git - git clone https://github.com/plures/xnd.git - git clone https://github.com/plures/gumath.git + - git clone https://github.com/plures/xndtools.git - cd ndtypes - conda build .conda/libndtypes - conda build .conda/ndtypes @@ -32,6 +33,9 @@ build_script: - conda build .conda/gumath - ps: $env:LIBGUMATH = (conda build --output .conda/libgumath) - ps: $env:GUMATH = (conda build --output .conda/gumath) + - cd ..\xndtools + - conda build .conda + - ps: $env:XNDTOOLS = (conda build --output .conda) - cd ..\..\scripts - ps: $env:UPLOAD_LIBNDTYPES = (python.exe check_upload.py libndtypes $env:LIBNDTYPES) - ps: $env:UPLOAD_NDTYPES = (python.exe check_upload.py ndtypes $env:NDTYPES) @@ -39,6 +43,7 @@ build_script: - ps: $env:UPLOAD_XND = (python.exe check_upload.py xnd $env:XND) - ps: $env:UPLOAD_LIBGUMATH = (python.exe check_upload.py libgumath $env:LIBGUMATH) - ps: $env:UPLOAD_GUMATH = (python.exe check_upload.py gumath $env:GUMATH) + - ps: $env:UPLOAD_XNDTOOLS = (python.exe check_upload.py xndtools $env:XNDTOOLS) on_success: @@ -48,6 +53,7 @@ on_success: - ps: if((-not $env:APPVEYOR_PULL_REQUEST_NUMBER) -and ($env:UPLOAD_XND -eq "true")) { cmd /C anaconda --token $env:anaconda_token upload $env:XND --user xnd --label dev "2>&1" } - ps: if((-not $env:APPVEYOR_PULL_REQUEST_NUMBER) -and ($env:UPLOAD_LIBGUMATH -eq "true")) { cmd /C anaconda --token $env:anaconda_token upload $env:LIBGUMATH --user xnd --label dev "2>&1" } - ps: if((-not $env:APPVEYOR_PULL_REQUEST_NUMBER) -and ($env:UPLOAD_GUMATH -eq "true")) { cmd /C anaconda --token $env:anaconda_token upload $env:GUMATH --user xnd --label dev "2>&1" } + - ps: if((-not $env:APPVEYOR_PULL_REQUEST_NUMBER) -and ($env:UPLOAD_XNDTOOLS -eq "true")) { cmd /C anaconda --token $env:anaconda_token upload $env:XNDTOOLS --user xnd --label dev "2>&1" } environment: anaconda_token: diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b754881 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/python/ diff --git a/.travis.yml b/.travis.yml index 11e3b5b..3cc6dee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -78,18 +78,21 @@ matrix: - export XND=`conda build --output build/xnd/.conda/xnd` - export LIBGUMATH=`conda build --output build/gumath/.conda/libgumath` - export GUMATH=`conda build --output build/gumath/.conda/gumath` + - export XNDTOOLS=`conda build --output build/xndtools/.conda` - export UPLOAD_LIBNDTYPES=`python3 check_upload.py libndtypes $LIBNDTYPES` - export UPLOAD_NDTYPES=`python3 check_upload.py ndtypes $NDTYPES` - export UPLOAD_LIBXND=`python3 check_upload.py libxnd $LIBXND` - export UPLOAD_XND=`python3 check_upload.py xnd $XND` - export UPLOAD_LIBGUMATH=`python3 check_upload.py libgumath $LIBGUMATH` - export UPLOAD_GUMATH=`python3 check_upload.py gumath $GUMATH` + - export UPLOAD_XNDTOOLS=`python3 check_upload.py xndtools $XNDTOOLS` - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_LIBNDTYPES" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $LIBNDTYPES --user xnd --label dev; fi - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_NDTYPES" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $NDTYPES --user xnd --label dev; fi - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_LIBXND" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $LIBXND --user xnd --label dev; fi - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_XND" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $XND --user xnd --label dev; fi - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_LIBGUMATH" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $LIBGUMATH --user xnd --label dev; fi - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_GUMATH" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $GUMATH --user xnd --label dev; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_XNDTOOLS" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $XNDTOOLS --user xnd --label dev; fi - language: objective-c os: osx @@ -114,18 +117,21 @@ matrix: - export XND=`conda build --output build/xnd/.conda/xnd` - export LIBGUMATH=`conda build --output build/gumath/.conda/libgumath` - export GUMATH=`conda build --output build/gumath/.conda/gumath` + - export XNDTOOLS=`conda build --output build/xndtools/.conda` - export UPLOAD_LIBNDTYPES=`python3 check_upload.py libndtypes $LIBNDTYPES` - export UPLOAD_NDTYPES=`python3 check_upload.py ndtypes $NDTYPES` - export UPLOAD_LIBXND=`python3 check_upload.py libxnd $LIBXND` - export UPLOAD_XND=`python3 check_upload.py xnd $XND` - export UPLOAD_LIBGUMATH=`python3 check_upload.py libgumath $LIBGUMATH` - export UPLOAD_GUMATH=`python3 check_upload.py gumath $GUMATH` + - export UPLOAD_XNDTOOLS=`python3 check_upload.py xndtools $XNDTOOLS` - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_LIBNDTYPES" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $LIBNDTYPES --user xnd --label dev; fi - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_NDTYPES" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $NDTYPES --user xnd --label dev; fi - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_LIBXND" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $LIBXND --user xnd --label dev; fi - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_XND" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $XND --user xnd --label dev; fi - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_LIBGUMATH" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $LIBGUMATH --user xnd --label dev; fi - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_GUMATH" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $GUMATH --user xnd --label dev; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false" && test X"$UPLOAD_XNDTOOLS" = X"true"; then anaconda --token $ANACONDA_TOKEN upload $XNDTOOLS --user xnd --label dev; fi env: global: diff --git a/scripts/conda-install.bat b/scripts/conda-install.bat index 7f7d793..76e71db 100755 --- a/scripts/conda-install.bat +++ b/scripts/conda-install.bat @@ -3,6 +3,7 @@ mkdir build && cd build git clone https://github.com/plures/ndtypes.git git clone https://github.com/plures/xnd.git git clone https://github.com/plures/gumath.git +git clone https://github.com/plures/xndtools.git cd ndtypes conda build .conda\libndtypes @@ -19,6 +20,9 @@ conda build .conda\libgumath conda build .conda\gumath conda install --use-local --yes gumath -cd ..\..\ +cd ..\xndtools +conda build .conda +conda install --use-local --yes xndtools +cd ..\..\ diff --git a/scripts/conda-install.sh b/scripts/conda-install.sh index 58bceb4..9d703b4 100755 --- a/scripts/conda-install.sh +++ b/scripts/conda-install.sh @@ -10,6 +10,7 @@ mkdir build && cd build || exit 1 git clone https://github.com/plures/ndtypes.git || exit 1 git clone https://github.com/plures/xnd.git || exit 1 git clone https://github.com/plures/gumath.git || exit 1 +git clone https://github.com/plures/xndtools.git || exit 1 cd ndtypes || exit 1 conda build .conda/libndtypes || exit 1 @@ -26,4 +27,7 @@ conda build .conda/libgumath || exit 1 conda build .conda/gumath || exit 1 conda install --use-local --yes gumath || exit 1 +cd ../xndtools || exit 1 +conda build .conda || exit 1 +conda install --use-local --yes xndtools || exit 1 diff --git a/setup.py b/setup.py index 97428ea..8c1f376 100644 --- a/setup.py +++ b/setup.py @@ -43,6 +43,7 @@ except: SPHINX_BUILD = "sphinx" +py_xnd_libs = ("ndtypes", "xnd", "gumath", "xndtools") def err_exit(): sys.stderr.write( @@ -50,8 +51,11 @@ def err_exit(): sys.exit(1) def copy_tests(): - for lib in "ndtypes", "xnd", "gumath": - pattern = os.path.join(lib, "python", "*.py") + for lib in py_xnd_libs: + if lib == "xndtools": + pattern = os.path.join(lib, "test", "*.py") + else: + pattern = os.path.join(lib, "python", "*.py") files = glob(pattern) dest = os.path.join("python", "test") for f in files: @@ -62,7 +66,7 @@ def copy_tests(): err_exit() if sys.argv[1] == "install": - for lib in "ndtypes", "xnd", "gumath": + for lib in py_xnd_libs: os.chdir(lib) os.system('"%s" setup.py install' % sys.executable) os.chdir("..") @@ -71,9 +75,12 @@ def copy_tests(): elif sys.argv[1] == "develop": INSTALLDIR = os.path.join(os.getcwd(), "python") - for lib in "ndtypes", "xnd", "gumath": + for lib in py_xnd_libs: os.chdir(lib) - os.system('"%s" setup.py install --local=%s' % (sys.executable, INSTALLDIR)) + if lib == "xndtools": + os.system('"%s" setup.py develop' % sys.executable) + else: + os.system('"%s" setup.py install --local=%s' % (sys.executable, INSTALLDIR)) os.chdir("..") copy_tests() @@ -95,6 +102,10 @@ def copy_tests(): sys.exit(ret) ret = subprocess.call([sys.executable, "test/test_gumath.py"], env=env) + if ret != 0: + sys.exit(ret) + + ret = subprocess.call([sys.executable, "test/test_xndtools.py"], env=env) sys.exit(ret) elif sys.argv[1] == "doctest":