Skip to content

Commit 260dbe0

Browse files
committed
Tox
1 parent b3e911d commit 260dbe0

File tree

7 files changed

+116
-23
lines changed

7 files changed

+116
-23
lines changed

README.md README

File renamed without changes.

drfpasswordless/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
__title__ = 'drfpasswordless'
4-
__version__ = '0.1.0'
4+
__version__ = '1.0.0'
55
__author__ = 'Aaron Ng'
66
__license__ = 'MIT'
77
__copyright__ = 'Copyright 2017 Aaron Ng'

manifest.in

-3
This file was deleted.

requirements/testing.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# PyTest for running the tests.
2-
pytest==2.6.4
3-
pytest-django==2.8.0
4-
pytest-cov==1.6
2+
pytest==3.0.7
3+
pytest-django==3.1.2
4+
pytest-cov==2.4.0

setup.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[wheel]
2+
universal = 1

setup.py

+105-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,109 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
import os
5+
import re
6+
import shutil
7+
import sys
8+
19
from distutils.core import setup
210

11+
12+
def get_version(package):
13+
"""
14+
Return package version as listed in `__version__` in `init.py`.
15+
"""
16+
with open(os.path.join(package, '__init__.py'), 'rb') as init_py:
17+
src = init_py.read().decode('utf-8')
18+
return re.search("__version__ = ['\"]([^'\"]+)['\"]", src).group(1)
19+
20+
21+
name = 'drfpasswordless'
22+
version = get_version('drfpasswordless')
23+
package = 'drfpasswordless'
24+
description = 'Passwordless auth for Django Rest Framework Token Authentication.'
25+
url = 'https://github.com/aaronn/django-rest-framework-passwordless'
26+
author = 'Aaron Ng'
27+
author_email = 'hi@aaron.ng'
28+
license = 'MIT'
29+
install_requires = []
30+
31+
32+
def read(*paths):
33+
"""
34+
Build a file path from paths and return the contents.
35+
"""
36+
with open(os.path.join(*paths), 'r') as f:
37+
return f.read()
38+
39+
40+
def get_packages(package):
41+
"""
42+
Return root package and all sub-packages.
43+
"""
44+
return [dirpath
45+
for dirpath, dirnames, filenames in os.walk(package)
46+
if os.path.exists(os.path.join(dirpath, '__init__.py'))]
47+
48+
49+
def get_package_data(package):
50+
"""
51+
Return all files under the root package, that are not in a
52+
package themselves.
53+
"""
54+
walk = [(dirpath.replace(package + os.sep, '', 1), filenames)
55+
for dirpath, dirnames, filenames in os.walk(package)
56+
if not os.path.exists(os.path.join(dirpath, '__init__.py'))]
57+
58+
filepaths = []
59+
for base, filenames in walk:
60+
filepaths.extend([os.path.join(base, filename)
61+
for filename in filenames])
62+
return {package: filepaths}
63+
64+
65+
if sys.argv[-1] == 'publish':
66+
if os.system('pip freeze | grep wheel'):
67+
print('wheel not installed.\nUse `pip install wheel`.\nExiting.')
68+
sys.exit()
69+
if os.system('pip freeze | grep twine'):
70+
print('twine not installed.\nUse `pip install twine`.\nExiting.')
71+
sys.exit()
72+
os.system('python setup.py sdist bdist_wheel')
73+
os.system('twine upload dist/*')
74+
shutil.rmtree('dist')
75+
shutil.rmtree('build')
76+
shutil.rmtree('drfpasswordless.egg-info')
77+
print('You probably want to also tag the version now:')
78+
print(" git tag -a {0} -m 'version {0}'".format(version))
79+
print(' git push --tags')
80+
sys.exit()
81+
82+
383
setup(
4-
name='drfpasswordless',
5-
version='0.1.0',
6-
packages=['tests', 'drfpasswordless', 'drfpasswordless.templates'],
7-
url='https://github.com/aaronn/django-rest-framework-passwordless',
8-
license='MIT',
9-
author='Aaron Ng',
10-
author_email='hi@aaron.ng',
11-
description='Passwordless auth for Django Rest Framework Token Authentication.'
84+
name=name,
85+
version=version,
86+
url=url,
87+
license=license,
88+
description=description,
89+
long_description=read('README'),
90+
author=author,
91+
author_email=author_email,
92+
packages=get_packages(package),
93+
package_data=get_package_data(package),
94+
install_requires=install_requires,
95+
classifiers=[
96+
'Development Status :: 5 - Production/Stable',
97+
'Environment :: Web Environment',
98+
'Framework :: Django',
99+
'Intended Audience :: Developers',
100+
'License :: OSI Approved :: MIT License',
101+
'Operating System :: OS Independent',
102+
'Programming Language :: Python',
103+
'Programming Language :: Python :: 3',
104+
'Programming Language :: Python :: 3.3',
105+
'Programming Language :: Python :: 3.4',
106+
'Programming Language :: Python :: 3.5',
107+
'Topic :: Internet :: WWW/HTTP',
108+
]
12109
)
13-

tox.ini

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[tox]
22
envlist =
3-
py35-flake8,
4-
{py33,py34,py35}-django{1.8,1.9,1.10}-drf{3.1,3.2,3.3,3.4,3.5,3.6}
3+
py36-flake8,
4+
{py34,py35,py36}-django{1.8,1.9,1.10}-drf{3.1,3.2,3.3,3.4,3.5,3.6}
55

66
[testenv]
7-
commands = ./runtests.py --fast {posargs} --verbose
7+
commands = python runtests.py --fast {posargs} --verbose
88
setenv =
99
PYTHONDONTWRITEBYTECODE=1
1010
deps =
@@ -18,11 +18,9 @@ deps =
1818
drf3.5: djangorestframework<3.6
1919
drf3.6: djangorestframework<3.7
2020
-rrequirements/testing.txt
21-
install_command =
22-
pip install -U {opts} {packages}
2321

24-
[testenv:py35-flake8]
25-
commands = ./runtests.py --lintonly
22+
[testenv:py36-flake8]
23+
commands = python runtests.py --lintonly
2624
deps =
2725
-rrequirements/codestyle.txt
2826
-rrequirements/testing.txt

0 commit comments

Comments
 (0)