Skip to content

Commit

Permalink
Merge pull request #39 from nsat/makefile_update
Browse files Browse the repository at this point in the history
Smarter/better makefile; now with upload capability and builds source distribution.

Ran black on setup.py
  • Loading branch information
vinnyfuria authored May 13, 2020
2 parents 877a8ae + 99b5b18 commit be6cb34
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ venv/
ENV/
env.bak/
venv.bak/
.makerc

# Spyder project settings
.spyderproject
Expand Down
56 changes: 50 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,58 @@
.PHONEY: help
VERSION := $(shell python ./setup.py --version)
NAME := $(shell python ./setup.py --name)
ARCH ?= linux_x86_64
src := predict.py predict.c setup.py
sdist := dist/$(NAME)-$(VERSION).tar.gz
wheels := dist/$(NAME)-$(VERSION)-cp27-cp27m-$(ARCH).whl \
dist/$(NAME)-$(VERSION)-cp35-cp35m-$(ARCH).whl \
dist/$(NAME)-$(VERSION)-cp37-cp37m-$(ARCH).whl \
dist/$(NAME)-$(VERSION)-cp27-cp27mu-$(ARCH).whl \
dist/$(NAME)-$(VERSION)-cp36-cp36m-$(ARCH).whl \
dist/$(NAME)-$(VERSION)-cp38-cp38-$(ARCH).whl

-include .makerc

.PHONY: help
help:
@echo "Targets:"
@echo " clean: Removes distribution folders and artifacts from building"
@echo " manylinux-wheels: Builds binary and manylinux wheels for several python versions"
@echo " clean: Removes distribution folders and artifacts from building"
@echo " build: Builds source and wheel distributions"
@echo " upload: Uploads built source and wheel distributions to repository"
@echo " Requires env vars `REPO`, `USER`, `PASSWORD`"

.PHONY: clean
clean:
rm -rf dist wheelhouse build __pycache__ *.so *.egg-info
rm -rf wheelhouse dist/ build/ __pycache__/ *.egg-info/ tletools/*.pyc venv .pytest_cache/

.PHONY: build
build: sdist manylinux-wheels

.PHONY: manylinux-wheels
manylinux-wheels:
docker run --user $(shell id -u):$(shell id -g) -v $(shell pwd):/io quay.io/pypa/manylinux1_x86_64:latest \
manylinux-wheels: $(wheels)

$(wheels) &: $(src)
docker run --user $(shell id -u):$(shell id -g) -v $(shell pwd):/io \
quay.io/pypa/manylinux1_x86_64:latest \
/io/bin/build-manylinux-wheel.sh 27 35 36 37 38

.PHONY: sdist
sdist: $(sdist)

$(sdist): $(src)
python setup.py sdist

.PHONY: upload
upload: build check-env
twine upload --repository-url ${REPO} --username ${USER} --password "${PASSWORD}" dist/*

.PHONY: check-env
check-env:
ifndef REPO
$(error $REPO must be specified)
endif
ifndef USER
$(error USER must be specified)
endif
ifndef PASSWORD
$(error PASSWORD must be specified)
endif
6 changes: 3 additions & 3 deletions bin/build-manylinux-wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ function get-variants() {
}

cd /io || exit
mkdir -p wheelhouse || exit
mkdir -p dist || exit

for version in ${PYTHON_VERSIONS} ; do
for variant in $(get-variants "${version}") ; do
"/opt/python/cp${version}-cp${version}${variant}/bin/pip" --no-cache-dir wheel /io -w wheelhouse/
"/opt/python/cp${version}-cp${version}${variant}/bin/pip" --no-cache-dir wheel /io -w dist/
done
done

for f in wheelhouse/*.whl ; do
for f in dist/*.whl ; do
/usr/local/bin/auditwheel repair "${f}"
done
23 changes: 12 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
#!/usr/bin/env python

from setuptools import setup, Extension

setup(
name='pypredict',
version='1.6.0',
name="pypredict",
version="1.6.1",
author="Jesse Trutna",
author_email="[email protected]",
url="https://github.com/nsat/pypredict",
py_modules=['predict'],
ext_modules=[Extension('cpredict', ['predict.c'])],
py_modules=["predict"],
ext_modules=[Extension("cpredict", ["predict.c"])],
classifiers=[
'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
)
)

0 comments on commit be6cb34

Please sign in to comment.