Skip to content

Commit

Permalink
upload_package.sh is now *.py
Browse files Browse the repository at this point in the history
  • Loading branch information
zackees committed May 10, 2023
1 parent fe9ad5e commit b53fd92
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
33 changes: 33 additions & 0 deletions upload_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python

"""
Uploads the package to PyPI.
"""

import os
import subprocess
import shutil
import sys

PYTHON_EXE = sys.executable
PIP_EXE = os.path.join(os.path.dirname(PYTHON_EXE), "pip")

# Equivalent to 'rm -rf build dist'
if os.path.exists('build'):
shutil.rmtree('build', ignore_errors=True)
if os.path.exists('dist'):
shutil.rmtree('dist', ignore_errors=True)

# Equivalent to 'pip install wheel twine'
subprocess.check_call([PIP_EXE, 'install', 'wheel', 'twine'])

print("Building Source and Wheel (universal) distribution…")
# Equivalent to 'python setup.py sdist bdist_wheel --universal'
subprocess.check_call([PYTHON_EXE, 'setup.py', 'sdist', 'bdist_wheel', '--universal'])

print("Uploading the package to PyPI via Twine…")
# Equivalent to 'twine upload dist/* --verbose'
subprocess.check_call(['twine', 'upload', 'dist/*', '--verbose'])

print("Pushing git tags…")
subprocess.check_call(['git', 'push', '--tags'])
10 changes: 0 additions & 10 deletions upload_package.sh

This file was deleted.

0 comments on commit b53fd92

Please sign in to comment.