Skip to content

Commit

Permalink
Merge pull request #506 from neurodata/pip
Browse files Browse the repository at this point in the history
EHN define automatic pip upload
  • Loading branch information
jdey4 authored Oct 21, 2021
2 parents af97aed + 17a3dc8 commit 9c2b7da
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
10 changes: 4 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ jobs:
name: init .pypirc
command: |
echo -e "[pypi]" >> ~/.pypirc
echo -e "username = $PYPI_USERNAME" >> ~/.pypirc
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
echo -e "username = __token__" >> ~/.pypirc
echo -e "password = $PIP_TOKEN" >> ~/.pypirc
- run:
name: create packages
command: |
python setup.py sdist
python setup.py sdist bdist_wheel
- run:
name: upload to pypi
command: |
Expand All @@ -132,10 +132,8 @@ workflows:
requires:
- "v3.8"
- deploy:
requires:
- "proglearn"
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
only: /v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
24 changes: 23 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from setuptools import setup, find_packages
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.install import install

# Find mgc version.
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -13,6 +15,23 @@
with open("requirements.txt", mode="r", encoding="utf8") as f:
REQUIREMENTS = f.read()


class VerifyVersionCommand(install):
"""Custom command to verify that the git tag matches our version"""

description = "verify that the git tag matches our version"

def run(self):
tag = os.getenv("CIRCLE_TAG")
version = "v{}".format(VERSION)

if tag != version:
info = "Git tag: {0} does not match the version of this app: {1}".format(
tag, version
)
sys.exit(info)


setup(
name="proglearn",
version=VERSION,
Expand All @@ -37,4 +56,7 @@
install_requires=REQUIREMENTS,
packages=find_packages(exclude=["tests", "tests.*", "tests/*"]),
include_package_data=True,
cmdclass={
"verify": VerifyVersionCommand,
},
)

0 comments on commit 9c2b7da

Please sign in to comment.