Up Version Django/PY3, drop PY2

This commit is contained in:
Val Neekman (AvidCoder) 2022-01-31 16:13:42 -05:00
parent ae6a0a61ae
commit 2d820df3a6
8 changed files with 82 additions and 126 deletions

View file

@ -1,45 +0,0 @@
sudo: false
language: python
dist: xenial
python:
- "3.5"
- "3.6"
- "3.7"
- "2.7"
- pypy
- pypy3
env:
- DJANGO="django==3.0"
- DJANGO="django==2.2.8"
- DJANGO="django==1.11.26"
install:
- pip install $DJANGO
- pip install -r requirements.txt
- pip install -r requirements_dev.txt
- pip install -e .
- pip install https://github.com/un33k/pyflakes/tarball/master
- pip install coveralls
before_script:
- "pycodestyle --exclude=migrations --ignore=E501,E225,E128 ."
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pyflakes -x W uuslug; fi
matrix:
exclude:
- python: "3.5"
env: DJANGO="django==3.0"
- python: "2.7"
env: DJANGO="django==2.2.8"
- python: "2.7"
env: DJANGO="django==3.0"
- python: pypy
env: DJANGO="django==2.2.8"
- python: pypy
env: DJANGO="django==3.0"
script: coverage run --source=uuslug manage.py test
after_success: coveralls

4
requirements-dev.txt Normal file
View file

@ -0,0 +1,4 @@
Django==4.0
pycodestyle==2.7.0
flake8==3.9.2
twine==3.4.2

View file

@ -1,2 +0,0 @@
Django>=2.2.26
python-slugify>=5.0.0

View file

@ -1 +0,0 @@
pycodestyle>=2.5.0

View file

@ -1,3 +1,2 @@
[flake8]
exclude = migrations
ignore = E501,E225,E128
[metadata]
license_file = LICENSE

139
setup.py
View file

@ -1,86 +1,83 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import re
# Learn more: https://github.com/un33k/setup.py
import os
import sys
from codecs import open
from shutil import rmtree
from setuptools import setup
name = 'django-uuslug'
package = 'uuslug'
description = 'A Django slugify application that guarantees uniqueness and handles unicode.'
url = 'https://github.com/un33k/django-uuslug'
author = 'Val Neekman'
author_email = 'info@neekware.com'
license = 'BSD'
install_requires = ['python-slugify>=5.0.0']
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
]
python_requires = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
here = os.path.abspath(os.path.dirname(__file__))
requires = []
test_requirements = []
about = {}
with open(os.path.join(here, package, '__version__.py'), 'r', 'utf-8') as f:
exec(f.read(), about)
with open('README.md', 'r', 'utf-8') as f:
readme = f.read()
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, '__init__.py')).read()
return re.search("^__version__ = ['\"]([^'\"]+)['\"]", init_py, re.MULTILINE).group(1)
def get_packages(package):
"""
Return root package and all sub-packages.
"""
return [dirpath
for dirpath, dirnames, filenames in os.walk(package)
if os.path.exists(os.path.join(dirpath, '__init__.py'))]
def get_package_data(package):
"""
Return all files under the root package, that are not in a
package themselves.
"""
walk = [(dirpath.replace(package + os.sep, '', 1), filenames)
for dirpath, dirnames, filenames in os.walk(package)
if not os.path.exists(os.path.join(dirpath, '__init__.py'))]
filepaths = []
for base, filenames in walk:
filepaths.extend([os.path.join(base, filename)
for filename in filenames])
return {package: filepaths}
def status(s):
print('\033[1m{0}\033[0m'.format(s))
# 'setup.py publish' shortcut.
if sys.argv[-1] == 'publish':
os.system("python setup.py sdist upload")
args = {'version': get_version(package)}
print("You probably want to also tag the version now:")
print(" git tag -a %(version)s -m 'version %(version)s' && git push --tags" % args)
try:
status('Removing previous builds…')
rmtree(os.path.join(here, 'dist'))
except OSError:
pass
status('Building Source and Wheel (universal) distribution…')
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
status('Uploading the package to PyPI via Twine…')
os.system('twine upload dist/*')
status('Pushing git tags…')
os.system('git tag v{0}'.format(about['__version__']))
os.system('git push --tags')
sys.exit()
setup(
name=name,
version=get_version(package),
url=url,
license=license,
description=description,
author=author,
author_email=author_email,
packages=get_packages(package),
package_data=get_package_data(package),
install_requires=install_requires,
classifiers=classifiers
name=about['__title__'],
version=about['__version__'],
description=about['__description__'],
long_description=readme,
long_description_content_type='text/markdown',
author=about['__author__'],
author_email=about['__author_email__'],
url=about['__url__'],
packages=[package],
package_data={'': ['LICENSE']},
package_dir={'uuslug': 'uuslug'},
include_package_data=True,
python_requires=python_requires,
install_requires=requires,
license=about['__license__'],
zip_safe=False,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
cmdclass={},
tests_require=test_requirements,
extras_require={},
project_urls={},
)

View file

@ -1,7 +1,3 @@
from .uuslug import * # noqa
__author__ = 'Val Neekman @ Neekware Inc. [@vneekman]'
__description__ = 'A Python slugify application that also handles Unicode'
__version__ = '2.0.0'
default_app_config = 'uuslug.apps.AppConfig'

8
uuslug/__version__.py Normal file
View file

@ -0,0 +1,8 @@
__title__ = 'django-uuslug'
__author__ = 'Val Neekman'
__author_email__ = 'info@neekware.com'
__description__ = "A Django slugify application that also handles Unicode"
__url__ = 'https://github.com/un33k/django-uuslug'
__license__ = 'MIT'
__copyright__ = 'Copyright 2022 Val Neekman @ Neekware Inc.'
__version__ = '2.0.0'