Skip to content

Pypi upload fixes #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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