Skip to content
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

Private PYPI upload + dynamic versioning #87

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 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
33 changes: 28 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ SYSDEPS = \
python3-dev \
python-pip \
python3-pip

TEST_PREFIX = PYTHONWARNINGS=all FULLTEXT_TESTING=1
PASSWORD ?=

test: ## Run tests.
${MAKE} install-git-hooks
Expand Down Expand Up @@ -47,10 +47,6 @@ sysdeps: ## Install system deps (Ubuntu).
sudo apt-get install python
sudo pip2 install --pre --upgrade pyhwp

publish: ## Upload package on PYPI.
$(PYTHON) setup.py register
$(PYTHON) setup.py sdist upload

clean: ## Remove all build files.
rm -rf `find . -type d -name __pycache__ \
-o -type f -name \*.bak \
Expand Down Expand Up @@ -81,3 +77,30 @@ install-git-hooks: ## Install GIT pre-commit hook.

help: ## Display callable targets.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

# --- distribution

sdist: ## Create a tar.gz distribution.
$(PYTHON) setup.py sdist
$(PYTHON) setup.py --version

priv-pypi-upload: ## Upload source distribution on private PYPI repo.
# Note: to reference the uploaded distribution, requirements.txt will
# need an entry like this:
# --extra-index-url http://pypi.dev.veristack.com/root/veristack-fulltext/+simple/
# fulltext==0.8.315.b00117c
${MAKE} sdist
venv/bin/pip install devpi-client
ifndef PASSWORD
venv/bin/python -m devpi login root
else
venv/bin/python -m devpi login root --password=$(PASSWORD)
endif
# Create index (done once)
# venv/bin/python -m devpi index --create root/veristack-fulltext
venv/bin/python -m devpi use http://pypi.dev.veristack.com/root/veristack-fulltext
venv/bin/python -m devpi upload -v dist/fulltext-`$(PYTHON) setup.py --version`.tar.gz

publish: ## Upload package on PYPI.
$(PYTHON) setup.py register
$(PYTHON) setup.py sdist upload
17 changes: 16 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@

import os
import sys
import subprocess
from os.path import dirname
from os.path import join as pathjoin
from setuptools import find_packages
from setuptools import setup


NAME = 'fulltext'
VERSION = '0.7'
if os.path.isdir('.git'):
# Version is "0.X.{num-commits}.{short-git-hash}",
# e.g. "pkg-0.2.102.3de9bd2".
_gitcount = subprocess.check_output(
"git rev-list --count --first-parent HEAD",
shell=True).strip().decode()
_githash = subprocess.check_output(
"git rev-parse --short HEAD", shell=True).strip().decode()
VERSION = "0.8+0.%s.%s" % (_gitcount, _githash)
else:
# This is here mainly for testing the .tar.gz distribution which
# has no .git directory. Distros published on the PYPI repo are
# supposed to use the above versioning notation.
VERSION = "0.8.0"

if os.name == 'nt' and not sys.maxsize > 2 ** 32:
# https://github.com/btimby/fulltext/issues/79
raise RuntimeError("Python 32 bit is not supported")
Expand Down