From 5826d0d022b84be6419979c30a61507ba1384359 Mon Sep 17 00:00:00 2001 From: Val Neekman Date: Tue, 11 Apr 2017 10:05:45 -0400 Subject: build/publish enhancements --- .gitignore | 2 ++ CHANGELOG.md | 4 ++++ MANIFEST.in | 3 --- setup.cfg | 2 ++ setup.py | 38 +++++++++----------------------------- slugify/__init__.py | 2 +- 6 files changed, 18 insertions(+), 33 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 setup.cfg diff --git a/.gitignore b/.gitignore index 8025fb9..6cc65d2 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,5 @@ docs/_build/ # PyBuilder target/ + +*.*DS_Store diff --git a/CHANGELOG.md b/CHANGELOG.md index 57bf6fb..aa33321 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.2.3 + - Remove build artifacts during packaging + - Simplify the setup.py file (@reece) + ## 1.2.3 - Republish - possible corrupt 1.2.2 build diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index a308077..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -include LICENSE -include README.rst -include requirements.txt diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..3c6e79c --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup.py b/setup.py index f944f42..abfaa3f 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from setuptools import setup +from setuptools import setup, find_packages import re import os import sys @@ -19,8 +19,9 @@ install_requires = ['Unidecode>=0.04.16'] classifiers = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', + 'Topic :: Software Development :: Build Tools', 'License :: OSI Approved :: MIT License', - 'Operating System :: POSIX', + 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', @@ -41,38 +42,17 @@ def get_version(package): 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} - +if sys.argv[-1] == 'build': + os.system("python setup.py sdist bdist_wheel") if sys.argv[-1] == 'publish': - os.system("python setup.py sdist upload") + os.system("twine upload dist/*") 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) sys.exit() +EXCLUDE_FROM_PACKAGES = [] setup( name=name, @@ -80,10 +60,10 @@ setup( url=url, license=license, description=description, + long_description=description, author=author, author_email=author_email, - packages=get_packages(package), - package_data=get_package_data(package), + packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES), install_requires=install_requires, classifiers=classifiers, entry_points={'console_scripts': ['slugify=slugify.slugify:main']}, diff --git a/slugify/__init__.py b/slugify/__init__.py index ba4a2af..79e1d28 100644 --- a/slugify/__init__.py +++ b/slugify/__init__.py @@ -3,4 +3,4 @@ from .slugify import * __author__ = 'Val Neekman @ Neekware Inc. [@vneekman]' __description__ = 'A Python slugify application that also handles Unicode' -__version__ = '1.2.3' +__version__ = '1.2.4' -- cgit v1.2.1 From 3fafff8cef9b43a816dafb5e0c14e14b04958266 Mon Sep 17 00:00:00 2001 From: Loisaida Sam Date: Mon, 8 May 2017 08:02:18 -0400 Subject: Update CHANGELOG.md - didn't you mean `1.2.4`? (#40) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa33321..a16c72a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 1.2.3 +## 1.2.4 - Remove build artifacts during packaging - Simplify the setup.py file (@reece) -- cgit v1.2.1 From e14bde218d794869eba8d23949bf0a9de8611a46 Mon Sep 17 00:00:00 2001 From: "Francis T. O'Donovan" Date: Mon, 8 May 2017 08:06:49 -0400 Subject: Create MANIFEST.in (#42) Add the `LICENSE` and other files to `MANIFEST.in` so that they will be included in sdists and other packages. This came up during packaging of `python-slugify` for `conda-forge`. --- MANIFEST.in | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..a755e2e --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include CHANGELOG.md +include LICENSE +include README.rst -- cgit v1.2.1 From 874fe140aa68ee1065e2170385f8c4ace5ac644a Mon Sep 17 00:00:00 2001 From: bolkedebruin Date: Sun, 25 Mar 2018 03:48:47 +0200 Subject: Use unidecode as an API and allow alternatives (#53) This PR allows specifying WITH_TEXTUNIDECODE when installing python-slugify. This allows using text-unidecode instead of unidecode. It will default to using unidecode. Closes: #51 --- .travis.yml | 6 +++++- README.rst | 16 ++++++++++++++++ alt_requirements.txt | 1 + setup.py | 5 ++++- slugify/slugify.py | 6 ++++-- 5 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 alt_requirements.txt diff --git a/.travis.yml b/.travis.yml index d852b0a..737fa21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,13 @@ python: - "3.6" - pypy +env: + - WITH_TEXTUNIDECODE=yes + - WITH_UNIDECODE=yes # this is redundant but otherwise travis will only trigger one build type + install: - pip install pip -U - - pip install -q -r requirements.txt + - if [[ -z "${WITH_TEXTUNIDECODE}" ]]; then pip install -q -r requirements.txt; else pip install -q -r alt_requirements.txt; fi - pip install -e . - pip install pep8 - pip install coveralls diff --git a/README.rst b/README.rst index a5a62ac..29b6e27 100644 --- a/README.rst +++ b/README.rst @@ -211,3 +211,19 @@ X.Y.Z Version :target: https://pypi.python.org/pypi/python-slugify .. _MIT: https://github.com/un33k/python-slugify/blob/master/LICENSE + + +GPL +--- + +By default python-slugify depends on **unidecode** which is released under GPL. In case this is +a concern to you it is possible to install slugify with **text-unidecode** which is dual licensed +Perl Artistic and GPL. This can be done by: + +.. code:: bash + + $ export WITH_TEXTUNIDECODE=yes + +And then proceed with the normal installation instructions. Please note that this needs to be specified +for every upgrade. Also be aware that in case **unidecode* is present on the system python-slugify will +still default to using it. diff --git a/alt_requirements.txt b/alt_requirements.txt new file mode 100644 index 0000000..980e50a --- /dev/null +++ b/alt_requirements.txt @@ -0,0 +1 @@ +text-unidecode>=1.2 \ No newline at end of file diff --git a/setup.py b/setup.py index abfaa3f..dcf21df 100755 --- a/setup.py +++ b/setup.py @@ -15,7 +15,10 @@ url = 'https://github.com/un33k/python-slugify' author = 'Val Neekman' author_email = 'info@neekware.com' license = 'MIT' -install_requires = ['Unidecode>=0.04.16'] +if "WITH_TEXTUNIDECODE" in os.environ: + install_requires = ['text-unidecode>=1.2'] +else: + install_requires = ['Unidecode>=0.04.16'] classifiers = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', diff --git a/slugify/slugify.py b/slugify/slugify.py index af0c609..8619184 100644 --- a/slugify/slugify.py +++ b/slugify/slugify.py @@ -13,8 +13,10 @@ except ImportError: _unicode_type = str unichr = chr -import unidecode - +try: + import unidecode +except ImportError: + import text_unidecode as unidecode __all__ = ['slugify', 'smart_truncate'] -- cgit v1.2.1