Skip to content

Commit

Permalink
Move version info into package (#166)
Browse files Browse the repository at this point in the history
* Ensure all open calls are relative to setup.py

* Move version info into package

* Ensure setup.py is exercised by make

* Ensure dist files get cleaned up
  • Loading branch information
c-w committed Apr 29, 2019
1 parent 699b575 commit d0159dd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include requirements.txt
include README.rst
include version.txt
recursive-include opwen_email_client/webapp/static *
recursive-include opwen_email_client/webapp/templates *.html
recursive-include opwen_email_client/webapp/translations *.po
13 changes: 8 additions & 5 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ settings=$(dir $(abspath $(lastword $(MAKEFILE_LIST)))).env
.PHONY: default venv tests
default: server

requirements.txt.out: requirements.txt requirements-dev.txt
requirements.txt.out: setup.py requirements.txt requirements-dev.txt
if [ ! -d $(py_env) ]; then python3 -m venv $(py_env) && $(py_env)/bin/pip install -U pip wheel | tee requirements.txt.out; fi
$(py_env)/bin/pip install -r requirements.txt | tee requirements.txt.out
$(py_env)/bin/pip install -e . | tee requirements.txt.out
$(py_env)/bin/pip install -r requirements-dev.txt | tee requirements.txt.out

venv: requirements.txt.out
Expand Down Expand Up @@ -52,16 +52,19 @@ prepare-server: venv compile-translations build-frontend
clean:
find opwen_email_client -name '__pycache__' -type d -print0 | xargs -0 rm -rf
find tests -name '__pycache__' -type d -print0 | xargs -0 rm -rf
rm -rf dist/ opwen_email_client.egg-info/

release: prepare-server
echo "$(VERSION)" > version.txt
bump-version:
sed -i "s|^__version__ = '[^']*'|__version__ = '$(VERSION)'|g" opwen_email_client/__init__.py

release: prepare-server bump-version
$(py_env)/bin/pip install twine
$(py_env)/bin/python setup.py sdist
$(py_env)/bin/twine upload -u "$(PYPI_USERNAME)" -p "$(PYPI_PASSWORD)" dist/*

server: prepare-server
OPWEN_SETTINGS=$(settings) \
$(py_env)/bin/python ./manage.py devserver
$(py_env)/bin/manage.py devserver

gunicorn: prepare-server
$(py_env)/bin/gunicorn \
Expand Down
1 change: 1 addition & 0 deletions opwen_email_client/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.0.0'
21 changes: 13 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
from setuptools import find_packages
import re
from pathlib import Path

from setuptools import setup

with open('requirements.txt', encoding='utf-8') as fobj:
package = 'opwen_email_client'
here = Path(__file__).parent

with (here / 'requirements.txt').open(encoding='utf-8') as fobj:
install_requires = [line.strip() for line in fobj]

with open('README.rst', encoding='utf-8') as fobj:
with (here / 'README.rst').open(encoding='utf-8') as fobj:
long_description = fobj.read()

with open('version.txt', encoding='utf-8') as fobj:
version = fobj.read().strip()
with (here / package / '__init__.py').open(encoding='utf-8') as fobj:
version = re.search(r"^__version__ = '([^']*)'",
fobj.read(), re.MULTILINE).group(1)

packages = find_packages(exclude=['tests*'])
scripts = ['manage.py']

setup(
name='opwen_email_client',
name=package,
version=version,
author='Clemens Wolff',
author_email='clemens.wolff+pypi@gmail.com',
packages=packages,
packages=[package],
url='https://github.com/ascoderu/opwen-webapp',
license='Apache Software License',
description='Email client for the Lokole project: https://ascoderu.ca',
Expand Down
1 change: 0 additions & 1 deletion version.txt

This file was deleted.

0 comments on commit d0159dd

Please sign in to comment.