From 43c5f2da2fb6332b04574dfde6209819998d9854 Mon Sep 17 00:00:00 2001 From: Stefan Krah Date: Sun, 9 Sep 2018 22:55:16 +0200 Subject: [PATCH] Use the new --skip-existing flag. --- .appveyor_conda.yml | 23 +++++++--------------- .travis.yml | 42 ++++++++++++++--------------------------- scripts/check_upload.py | 41 ---------------------------------------- 3 files changed, 21 insertions(+), 85 deletions(-) delete mode 100755 scripts/check_upload.py diff --git a/.appveyor_conda.yml b/.appveyor_conda.yml index b1b06be..9a9e88d 100644 --- a/.appveyor_conda.yml +++ b/.appveyor_conda.yml @@ -36,24 +36,15 @@ build_script: - 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: - - ps: if((-not $env:APPVEYOR_PULL_REQUEST_NUMBER) -and ($env:UPLOAD_LIBNDTYPES -eq "true")) { cmd /C anaconda --token $env:anaconda_token upload $env:LIBNDTYPES --user xnd --label dev "2>&1" } - - ps: if((-not $env:APPVEYOR_PULL_REQUEST_NUMBER) -and ($env:UPLOAD_NDTYPES -eq "true")) { cmd /C anaconda --token $env:anaconda_token upload $env:NDTYPES --user xnd --label dev "2>&1" } - - ps: if((-not $env:APPVEYOR_PULL_REQUEST_NUMBER) -and ($env:UPLOAD_LIBXND -eq "true")) { cmd /C anaconda --token $env:anaconda_token upload $env:LIBXND --user xnd --label dev "2>&1" } - - 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" } + - ps: if(-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { cmd /C anaconda --token $env:anaconda_token upload $env:LIBNDTYPES --user xnd --label dev --skip-existing "2>&1" } + - ps: if(-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { cmd /C anaconda --token $env:anaconda_token upload $env:NDTYPES --user xnd --label dev --skip-existing "2>&1" } + - ps: if(-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { cmd /C anaconda --token $env:anaconda_token upload $env:LIBXND --user xnd --label dev --skip-existing "2>&1" } + - ps: if(-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { cmd /C anaconda --token $env:anaconda_token upload $env:XND --user xnd --label dev --skip-existing "2>&1" } + - ps: if(-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { cmd /C anaconda --token $env:anaconda_token upload $env:LIBGUMATH --user xnd --label dev --skip-existing "2>&1" } + - ps: if(-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { cmd /C anaconda --token $env:anaconda_token upload $env:GUMATH --user xnd --label dev --skip-existing "2>&1" } + - ps: if(-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { cmd /C anaconda --token $env:anaconda_token upload $env:XNDTOOLS --user xnd --label dev --skip-existing "2>&1" } environment: anaconda_token: diff --git a/.travis.yml b/.travis.yml index eeeaa38..81fc9ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,20 +79,13 @@ matrix: - 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=`python check_upload.py libndtypes $LIBNDTYPES` - - export UPLOAD_NDTYPES=`python check_upload.py ndtypes $NDTYPES` - - export UPLOAD_LIBXND=`python check_upload.py libxnd $LIBXND` - - export UPLOAD_XND=`python check_upload.py xnd $XND` - - export UPLOAD_LIBGUMATH=`python check_upload.py libgumath $LIBGUMATH` - - export UPLOAD_GUMATH=`python check_upload.py gumath $GUMATH` - - export UPLOAD_XNDTOOLS=`python 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 + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $LIBNDTYPES --user xnd --label dev --skip-existing; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $NDTYPES --user xnd --label dev --skip-existing; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $LIBXND --user xnd --label dev --skip-existing; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $XND --user xnd --label dev --skip-existing; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $LIBGUMATH --user xnd --label dev --skip-existing; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $GUMATH --user xnd --label dev --skip-existing; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $XNDTOOLS --user xnd --label dev --skip-existing; fi - language: objective-c os: osx @@ -118,20 +111,13 @@ matrix: - 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=`python check_upload.py libndtypes $LIBNDTYPES` - - export UPLOAD_NDTYPES=`python check_upload.py ndtypes $NDTYPES` - - export UPLOAD_LIBXND=`python check_upload.py libxnd $LIBXND` - - export UPLOAD_XND=`python check_upload.py xnd $XND` - - export UPLOAD_LIBGUMATH=`python check_upload.py libgumath $LIBGUMATH` - - export UPLOAD_GUMATH=`python check_upload.py gumath $GUMATH` - - export UPLOAD_XNDTOOLS=`python 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 + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $LIBNDTYPES --user xnd --label dev --skip-existing; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $NDTYPES --user xnd --label dev --skip-existing; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $LIBXND --user xnd --label dev --skip-existing; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $XND --user xnd --label dev --skip-existing; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $LIBGUMATH --user xnd --label dev --skip-existing; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $GUMATH --user xnd --label dev --skip-existing; fi + - if test X"$TRAVIS_BRANCH" = X"master" && test X"$TRAVIS_PULL_REQUEST" = X"false"; then anaconda --token $ANACONDA_TOKEN upload $XNDTOOLS --user xnd --label dev --skip-existing; fi env: global: diff --git a/scripts/check_upload.py b/scripts/check_upload.py deleted file mode 100755 index 65db540..0000000 --- a/scripts/check_upload.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python3 - -# -# Check if a conda package with a specific version has already been uploaded to -# anaconda.org. -# -# Write "true" to stdout if the package should be uploaded, "false" if -# it already exists. -# -# In case of an error, write "true": The upload should be attempted and -# fail if the package exists. -# - -import os -import sys -import subprocess -import json - - -if len(sys.argv) != 3: - sys.stdout.write("true\n") - sys.exit(0) - -package_name = sys.argv[1] -local_tarname = os.path.basename(sys.argv[2]) - -cmd = ["conda", "search", "--json", "-c", "xnd/label/dev", package_name] -try: - response = subprocess.check_output(cmd) -except: - sys.stdout.write("true\n") - sys.exit(0) - -try: - d = json.loads(response) - remote_tarname = d[package_name][-1]["fn"] -except: - sys.stdout.write("true\n") - sys.exit(0) - -sys.stdout.write("false\n" if local_tarname == remote_tarname else "true\n")