Skip to content

Commit

Permalink
Added packaging for xndtools (xnd-project#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
xmnlab authored and skrah committed Aug 23, 2018
1 parent af57b12 commit 7511355
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .appveyor_conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,13 +33,17 @@ 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)
- ps: $env:UPLOAD_LIBXND = (python.exe check_upload.py libxnd $env:LIBXND)
- 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:
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/python/
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion scripts/conda-install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ..\..\

4 changes: 4 additions & 0 deletions scripts/conda-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

21 changes: 16 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@
except:
SPHINX_BUILD = "sphinx"

py_xnd_libs = ("ndtypes", "xnd", "gumath", "xndtools")

def err_exit():
sys.stderr.write(
"setup.py: usage: python3 setup.py [install, develop, test, doctest]\n\n")
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:
Expand All @@ -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("..")
Expand All @@ -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()
Expand All @@ -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":
Expand Down

0 comments on commit 7511355

Please sign in to comment.