Skip to content

Commit

Permalink
Fix pypi uploads from appveyor (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkittenis authored Sep 27, 2020
1 parent ee6971c commit 5f90e62
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,6 @@ artifacts:
- path: "*.whl"

deploy_script:
- "%PYTHON_DEF%\\python.exe ci/appveyor/pypi_upload.py *.whl"
# Calling twine requires we set path
- "SET PATH=%PYTHON_DEF%;%PYTHON_DEF%\\Scripts;%PATH%"
- python ci/appveyor/pypi_upload.py *.whl
1 change: 1 addition & 0 deletions Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Changes

* Added function for setting GSS-API credentials delegation option to session.
* Updated error handling for all user authentication session functions to raise specific authentication errors.
* `ssh.Key.import_privkey_*` now defaults to empty passphrase.


0.5.0
Expand Down
15 changes: 9 additions & 6 deletions ci/appveyor/pypi_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@


def upload_pypi(files):
repo_tag = os.environ['APPVEYOR_REPO_TAG']
repo_tag = os.environ.get('APPVEYOR_REPO_TAG', 'false')
if repo_tag == 'false':
sys.stderr.write("Not a tagged release, skipping upload" + os.linesep)
return
_user, _pass = os.environ['PYPI_USER'], os.environ['PYPI_PASS']
try:
subprocess.check_call(['twine', 'upload', '-u', _user,
'-p', _pass, files])
except Exception:
_user, _pass = os.environ.get('PYPI_USER'), os.environ.get('PYPI_PASS')
if not _user or not _pass:
sys.stderr.write("No PyPi credentials set" + os.linesep)
sys.exit(1)
proc = subprocess.run(['twine', 'upload', '-u', _user,
'-p', _pass, files])
if proc.returncode:
sys.stderr.write("Error uploading to PyPi" + os.linesep)
sys.exit(1)


if __name__ == "__main__":
Expand Down

0 comments on commit 5f90e62

Please sign in to comment.