Hello community,
here is the log from the commit of package python-python-slugify for
openSUSE:Factory checked in at 2019-02-20 14:13:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-python-slugify (Old)
and /work/SRC/openSUSE:Factory/.python-python-slugify.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-python-slugify"
Wed Feb 20 14:13:12 2019 rev:3 rq:677459 version:2.0.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-python-slugify/python-python-slugify.changes
2018-12-24 11:42:41.745382765 +0100
+++
/work/SRC/openSUSE:Factory/.python-python-slugify.new.28833/python-python-slugify.changes
2019-02-20 14:13:14.306901230 +0100
@@ -1,0 +2,11 @@
+Tue Feb 19 17:11:03 UTC 2019 - John Vandenberg <[email protected]>
+
+- Activated test suite
+- Update to v2.0.1
+ * Add replacements option e.g. [['|', 'or'], ['%', 'percent'], ['-', '_']]
+- from 2.0.0
+ * Fix alternative dependency installation
+-from 1.2.6
+ * Add support for case sensitive slugs
+
+-------------------------------------------------------------------
Old:
----
python-slugify-1.2.5.tar.gz
New:
----
python-slugify-2.0.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-python-slugify.spec ++++++
--- /var/tmp/diff_new_pack.vMTTdb/_old 2019-02-20 14:13:14.762901078 +0100
+++ /var/tmp/diff_new_pack.vMTTdb/_new 2019-02-20 14:13:14.762901078 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-python-slugify
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,21 +17,18 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-%bcond_with test
Name: python-python-slugify
-Version: 1.2.5
+Version: 2.0.1
Release: 0
Summary: Slugify application that handles Unicode
License: MIT
Group: Development/Languages/Python
Url: https://github.com/un33k/python-slugify
-Source:
https://files.pythonhosted.org/packages/source/p/python-slugify/python-slugify-%{version}.tar.gz
+Source:
https://github.com/un33k/python-slugify/archive/%{version}.tar.gz#/python-slugify-%{version}.tar.gz
+BuildRequires: %{python_module Unidecode >= 0.04.16}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
-%if %{with test}
-BuildRequires: %{python_module Unidecode >= 0.04.16}
-%endif
Conflicts: python-awesome-slugify
Requires: python-Unidecode >= 0.04.16
BuildArch: noarch
@@ -51,14 +48,11 @@
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
-%if %{with test}
%check
-%python_exec setup.py test
-%endif
+%python_exec ./test.py
%files %{python_files}
-%defattr(-,root,root,-)
-%doc CHANGELOG.md README.rst
+%doc CHANGELOG.md README.md
%license LICENSE
%python3_only %{_bindir}/slugify
%{python_sitelib}/python_slugify-%{version}-py*.egg-info
++++++ python-slugify-1.2.5.tar.gz -> python-slugify-2.0.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/.gitignore
new/python-slugify-2.0.1/.gitignore
--- old/python-slugify-1.2.5/.gitignore 1970-01-01 01:00:00.000000000 +0100
+++ new/python-slugify-2.0.1/.gitignore 2019-01-04 00:03:36.000000000 +0100
@@ -0,0 +1,62 @@
+# JebBrains IDE
+.idea/
+
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*,cover
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+*.*DS_Store
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/.travis.yml
new/python-slugify-2.0.1/.travis.yml
--- old/python-slugify-1.2.5/.travis.yml 1970-01-01 01:00:00.000000000
+0100
+++ new/python-slugify-2.0.1/.travis.yml 2019-01-04 00:03:36.000000000
+0100
@@ -0,0 +1,25 @@
+sudo: false
+language: python
+
+python:
+ - "2.7"
+ - "3.4"
+ - "3.5"
+ - "3.6"
+ - pypy
+
+install:
+ - pip install pip -U
+ - pip install -e .
+ - pip install pycodestyle
+ - pip install coveralls
+ - pip install https://github.com/un33k/pyflakes/tarball/master
+
+before_script:
+ - "bash pycodestyle.sh"
+ - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pyflakes -x W slugify; fi
+
+script: coverage run --source=slugify test.py
+
+after_success:
+ coveralls
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/.vscode/settings.json
new/python-slugify-2.0.1/.vscode/settings.json
--- old/python-slugify-1.2.5/.vscode/settings.json 1970-01-01
01:00:00.000000000 +0100
+++ new/python-slugify-2.0.1/.vscode/settings.json 2019-01-04
00:03:36.000000000 +0100
@@ -0,0 +1,5 @@
+{
+ "python.linting.pylintEnabled": false,
+ "restructuredtext.confPath": "",
+ "python.pythonPath": "/usr/local/opt/python/bin/python3.6"
+}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/CHANGELOG.md
new/python-slugify-2.0.1/CHANGELOG.md
--- old/python-slugify-1.2.5/CHANGELOG.md 2018-03-25 17:00:57.000000000
+0200
+++ new/python-slugify-2.0.1/CHANGELOG.md 2019-01-04 00:03:36.000000000
+0100
@@ -1,3 +1,12 @@
+## 2.0.1
+ - Add replacements option e.g. [['|', 'or'], ['%', 'percent'], ['-', '_']]
(@andriyor)
+
+## 2.0.0
+ - Fix alternative dependency installation
+
+## 1.2.6
+ - Add support for case sensitive slugs (@s-m-e)
+
## 1.2.5
- Add support for using text-unidecode (@bolkedebruin)
- Switch to pycodestyle instead of pep8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/MANIFEST.in
new/python-slugify-2.0.1/MANIFEST.in
--- old/python-slugify-1.2.5/MANIFEST.in 2018-03-25 16:01:31.000000000
+0200
+++ new/python-slugify-2.0.1/MANIFEST.in 2019-01-04 00:03:36.000000000
+0100
@@ -1,3 +1,3 @@
include CHANGELOG.md
include LICENSE
-include README.rst
+include README.md
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/PKG-INFO
new/python-slugify-2.0.1/PKG-INFO
--- old/python-slugify-1.2.5/PKG-INFO 2018-03-25 17:03:17.000000000 +0200
+++ new/python-slugify-2.0.1/PKG-INFO 1970-01-01 01:00:00.000000000 +0100
@@ -1,24 +0,0 @@
-Metadata-Version: 1.1
-Name: python-slugify
-Version: 1.2.5
-Summary: A Python Slugify application that handles Unicode
-Home-page: https://github.com/un33k/python-slugify
-Author: Val Neekman
-Author-email: [email protected]
-License: MIT
-Description: A Python Slugify application that handles Unicode
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: Topic :: Software Development :: Build Tools
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
-Classifier: Programming Language :: Python :: 3.4
-Classifier: Programming Language :: Python :: 3.5
-Classifier: Programming Language :: Python :: 3.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/README.md
new/python-slugify-2.0.1/README.md
--- old/python-slugify-1.2.5/README.md 1970-01-01 01:00:00.000000000 +0100
+++ new/python-slugify-2.0.1/README.md 2019-01-04 00:03:36.000000000 +0100
@@ -0,0 +1,148 @@
+Python Slugify
+====================
+
+**A Python slugify application that handles unicode**.
+
+[![status-image]][status-link]
+[![version-image]][version-link]
+[![coverage-image]][coverage-link]
+
+Overview
+====================
+
+**Best attempt** to create slugs from unicode strings while keeping it **DRY**.
+
+Notice
+====================
+
+By default, this modules installs and uses
[Unidecode](https://github.com/avian2/unidecode) *(GPL)* for its decoding
needs. However if you wish to use
[text-unidecode](https://github.com/kmike/text-unidecode) *(GPL & Perl
Artistic)* instead, please ensure it is installed prior to `python-slugify`
installation.
+
+In cases where both `Unidecode` and `text-unidecode` are installed,
`Unidecode` is used as the default decoding module.
+
+
+How to install
+====================
+
+ 1. easy_install python-slugify
+ 2. pip install python-slugify
+ 3. git clone http://github.com/un33k/python-slugify
+ a. cd python-slugify
+ b. python setup.py install
+ 4. wget https://github.com/un33k/python-slugify/zipball/master
+ a. unzip the downloaded file
+ b. cd python-slugify-*
+ c. python setup.py install
+
+
+How to use
+====================
+
+ ```python
+ from slugify import slugify
+
+ txt = "This is a test ---"
+ r = slugify(txt)
+ self.assertEqual(r, "this-is-a-test")
+
+ txt = '影師嗎'
+ r = slugify(txt)
+ self.assertEqual(r, "ying-shi-ma")
+
+ txt = 'C\'est déjà l\'été.'
+ r = slugify(txt)
+ self.assertEqual(r, "c-est-deja-l-ete")
+
+ txt = 'Nín hǎo. Wǒ shì zhōng guó rén'
+ r = slugify(txt)
+ self.assertEqual(r, "nin-hao-wo-shi-zhong-guo-ren")
+
+ txt = 'Компьютер'
+ r = slugify(txt)
+ self.assertEqual(r, "kompiuter")
+
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt, max_length=9)
+ self.assertEqual(r, "jaja-lol")
+
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt, max_length=15, word_boundary=True)
+ self.assertEqual(r, "jaja-lol-a")
+
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt, max_length=20, word_boundary=True, separator=".")
+ self.assertEqual(r, "jaja.lol.mememeoo.a")
+
+ txt = 'one two three four five'
+ r = slugify(txt, max_length=13, word_boundary=True, save_order=True)
+ self.assertEqual(r, "one-two-three")
+
+ txt = 'the quick brown fox jumps over the lazy dog'
+ r = slugify(txt, stopwords=['the'])
+ self.assertEqual(r, 'quick-brown-fox-jumps-over-lazy-dog')
+
+ txt = 'the quick brown fox jumps over the lazy dog in a hurry'
+ r = slugify(txt, stopwords=['the', 'in', 'a', 'hurry'])
+ self.assertEqual(r, 'quick-brown-fox-jumps-over-lazy-dog')
+
+ txt = 'thIs Has a stopword Stopword'
+ r = slugify(txt, stopwords=['Stopword'], lowercase=False)
+ self.assertEqual(r, 'thIs-Has-a-stopword')
+
+ txt = "___This is a test___"
+ regex_pattern = r'[^-a-z0-9_]+'
+ r = slugify(txt, regex_pattern=regex_pattern)
+ self.assertEqual(r, "___this-is-a-test___")
+
+ txt = "___This is a test___"
+ regex_pattern = r'[^-a-z0-9_]+'
+ r = slugify(txt, separator='_', regex_pattern=regex_pattern)
+ self.assertNotEqual(r, "_this_is_a_test_")
+
+ txt = '10 | 20 %'
+ r = slugify(txt, replacements=[['|', 'or'], ['%', 'percent']])
+ self.assertEqual(r, "10-or-20-percent")
+
+ ```
+
+For more examples, have a look at the [test.py](test.py) file.
+
+
+Running the tests
+====================
+
+To run the tests against the current environment:
+
+ python test.py
+
+
+License
+====================
+
+Released under a ([MIT](LICENSE)) license.
+
+
+Version
+====================
+X.Y.Z Version
+
+ `MAJOR` version -- when you make incompatible API changes,
+ `MINOR` version -- when you add functionality in a backwards-compatible
manner, and
+ `PATCH` version -- when you make backwards-compatible bug fixes.
+
+[status-image]:
https://secure.travis-ci.org/un33k/python-slugify.png?branch=master
+[status-link]: http://travis-ci.org/un33k/python-slugify?branch=master
+
+[version-image]: https://img.shields.io/pypi/v/python-slugify.svg
+[version-link]: https://pypi.python.org/pypi/python-slugify
+
+[coverage-image]: https://coveralls.io/repos/un33k/python-slugify/badge.svg
+[coverage-link]: https://coveralls.io/r/un33k/python-slugify
+
+[download-image]: https://img.shields.io/pypi/dm/python-slugify.svg
+[download-link]: https://pypi.python.org/pypi/python-slugify
+
+
+Sponsors
+====================
+
+[](https://github.com/surgeforward)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/README.rst
new/python-slugify-2.0.1/README.rst
--- old/python-slugify-1.2.5/README.rst 2018-03-25 16:01:31.000000000 +0200
+++ new/python-slugify-2.0.1/README.rst 1970-01-01 01:00:00.000000000 +0100
@@ -1,224 +0,0 @@
-Python Slugify
-==============
-
-|status-image| |version-image| |coverage-image|
-
-Overview
---------
-
-A Python **slugify** application that handles **unicode**.
-
-
-How to install
---------------
-
-Via ``pip``:
-
-.. code:: bash
-
- $ pip install python-slugify
-
-Via ``easy_install``:
-
-.. code:: bash
-
- $ easy_install python-slugify
-
-From sources via ``git``:
-
-.. code:: bash
-
- $ git clone http://github.com/un33k/python-slugify
- $ cd python-slugify
- $ python setup.py install
-
-From sources:
-
-.. code:: bash
-
- $ wget https://github.com/un33k/python-slugify/zipball/master
- # unzip the downloaded file
- # cd into python-slugify-* directory
- $ python setup.py install
-
-Note:
-
-By default *python-slugify* installs **unidecode** (GPL) for its decoding
needs.
-
-Alternatively *python-slugify* can install and use **text-unidecode** (GPL &
Perl Artistic) instead. This is done by setting up
-an environment variable *SLUGIFY_USES_TEXT_UNIDECODE=yes* prior to installing
and/or upgrading `python-slugify`.
-
-In cases where both **unidecode** and **text-unidecode** are installed,
*python-slugify* always defaults to using **unidecode** regardless of the
*SLUGIFY_USES_TEXT_UNIDECODE=yes* environment variable.
-
-
-How to use
-----------
-
-.. code:: python
-
- from slugify import slugify
-
- txt = "This is a test ---"
- r = slugify(txt)
- self.assertEqual(r, "this-is-a-test")
-
- txt = "___This is a test ---"
- r = slugify(txt)
- self.assertEqual(r, "this-is-a-test")
-
- txt = "___This is a test___"
- r = slugify(txt)
- self.assertEqual(r, "this-is-a-test")
-
- txt = "This -- is a ## test ---"
- r = slugify(txt)
- self.assertEqual(r, "this-is-a-test")
-
- txt = '影師嗎'
- r = slugify(txt)
- self.assertEqual(r, "ying-shi-ma")
-
- txt = 'C\'est déjà l\'été.'
- r = slugify(txt)
- self.assertEqual(r, "c-est-deja-l-ete")
-
- txt = 'Nín hǎo. Wǒ shì zhōng guó rén'
- r = slugify(txt)
- self.assertEqual(r, "nin-hao-wo-shi-zhong-guo-ren")
-
- txt = 'jaja---lol-méméméoo--a'
- r = slugify(txt)
- self.assertEqual(r, "jaja-lol-mememeoo-a")
-
- txt = 'Компьютер'
- r = slugify(txt)
- self.assertEqual(r, "kompiuter")
-
- txt = 'jaja---lol-méméméoo--a'
- r = slugify(txt, max_length=9)
- self.assertEqual(r, "jaja-lol")
-
- txt = 'jaja---lol-méméméoo--a'
- r = slugify(txt, max_length=15)
- self.assertEqual(r, "jaja-lol-mememe")
-
- txt = 'jaja---lol-méméméoo--a'
- r = slugify(txt, max_length=50)
- self.assertEqual(r, "jaja-lol-mememeoo-a")
-
- txt = 'jaja---lol-méméméoo--a'
- r = slugify(txt, max_length=15, word_boundary=True)
- self.assertEqual(r, "jaja-lol-a")
-
- txt = 'jaja---lol-méméméoo--a'
- r = slugify(txt, max_length=17, word_boundary=True)
- self.assertEqual(r, "jaja-lol-mememeoo")
-
- txt = 'jaja---lol-méméméoo--a'
- r = slugify(txt, max_length=18, word_boundary=True)
- self.assertEqual(r, "jaja-lol-mememeoo")
-
- txt = 'jaja---lol-méméméoo--a'
- r = slugify(txt, max_length=19, word_boundary=True)
- self.assertEqual(r, "jaja-lol-mememeoo-a")
-
- txt = 'jaja---lol-méméméoo--a'
- r = slugify(txt, max_length=20, word_boundary=True, separator=".")
- self.assertEqual(r, "jaja.lol.mememeoo.a")
-
- txt = 'one two three four five'
- r = slugify(txt, max_length=13, word_boundary=True, save_order=True)
- self.assertEqual(r, "one-two-three")
-
- txt = 'one two three four five'
- r = slugify(txt, max_length=13, word_boundary=True, save_order=False)
- self.assertEqual(r, "one-two-three")
-
- txt = 'one two three four five'
- r = slugify(txt, max_length=12, word_boundary=True, save_order=False)
- self.assertEqual(r, "one-two-four")
-
- txt = 'one two three four five'
- r = slugify(txt, max_length=12, word_boundary=True, save_order=True)
- self.assertEqual(r, "one-two")
-
- txt = 'this has a stopword'
- r = slugify(txt, stopwords=['stopword'])
- self.assertEqual(r, 'this-has-a')
-
- txt = 'the quick brown fox jumps over the lazy dog'
- r = slugify(txt, stopwords=['the'])
- self.assertEqual(r, 'quick-brown-fox-jumps-over-lazy-dog')
-
- txt = 'Foo A FOO B foo C'
- r = slugify(txt, stopwords=['foo'])
- self.assertEqual(r, 'a-b-c')
-
- txt = 'Foo A FOO B foo C'
- r = slugify(txt, stopwords=['FOO'])
- self.assertEqual(r, 'a-b-c')
-
- txt = 'the quick brown fox jumps over the lazy dog in a hurry'
- r = slugify(txt, stopwords=['the', 'in', 'a', 'hurry'])
- self.assertEqual(r, 'quick-brown-fox-jumps-over-lazy-dog')
-
- txt = 'foo & bar'
- r = slugify(txt)
- self.assertEqual(r, 'foo-bar')
-
- txt = "___This is a test___"
- regex_pattern = r'[^-a-z0-9_]+'
- r = slugify(txt, regex_pattern=regex_pattern)
- self.assertEqual(r, "___this-is-a-test___")
-
- txt = "___This is a test___"
- regex_pattern = r'[^-a-z0-9_]+'
- r = slugify(txt, separator='_', regex_pattern=regex_pattern)
- self.assertNotEqual(r, "_this_is_a_test_")
-
-Running the tests
------------------
-
-To run the tests against the current environment:
-
-.. code:: bash
-
- python test.py
-
-
-License
--------
-
-Released under a (`MIT`_) license.
-
-**Note:**
-
-*python-slugify* relies on thirdparty **API** for decoding unicode strings.
This dependency is kept at the public **API** ONLY in
-order to ensure that *python-slugify* never becomes a **derivative work** of
any other packages. MIT license holds.
-
-
-Version
--------
-
-X.Y.Z Version
-
-::
-
- `MAJOR` version -- when you make incompatible API changes,
- `MINOR` version -- when you add functionality in a backwards-compatible
manner, and
- `PATCH` version -- when you make backwards-compatible bug fixes.
-
-.. |status-image| image::
https://secure.travis-ci.org/un33k/python-slugify.png?branch=master
- :target: http://travis-ci.org/un33k/python-slugify?branch=master
-
-.. |version-image| image:: https://img.shields.io/pypi/v/python-slugify.svg
- :target: https://pypi.python.org/pypi/python-slugify
-
-.. |coverage-image| image::
https://coveralls.io/repos/un33k/python-slugify/badge.svg
- :target: https://coveralls.io/r/un33k/python-slugify
-
-.. |download-image| image:: https://img.shields.io/pypi/dm/python-slugify.svg
- :target: https://pypi.python.org/pypi/python-slugify
-
-.. _MIT: https://github.com/un33k/python-slugify/blob/master/LICENSE
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/pycodestyle.sh
new/python-slugify-2.0.1/pycodestyle.sh
--- old/python-slugify-1.2.5/pycodestyle.sh 1970-01-01 01:00:00.000000000
+0100
+++ new/python-slugify-2.0.1/pycodestyle.sh 2019-01-04 00:03:36.000000000
+0100
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# Ignoring autogenerated files
+# -- Migration directories
+# Ignoring error codes
+# -- E128 continuation line under-indented for visual indent
+# -- E261 at least two spaces before inline comment
+# -- E225 missing whitespace around operator
+# -- E501 line too long
+# Ignoring warning codes
+# -- W605 invalid escape sequence '\d'
+
+pycodestyle --ignore=E128,E261,E225,E501,W605 slugify test.py setup.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python-slugify-1.2.5/python_slugify.egg-info/PKG-INFO
new/python-slugify-2.0.1/python_slugify.egg-info/PKG-INFO
--- old/python-slugify-1.2.5/python_slugify.egg-info/PKG-INFO 2018-03-25
17:03:17.000000000 +0200
+++ new/python-slugify-2.0.1/python_slugify.egg-info/PKG-INFO 1970-01-01
01:00:00.000000000 +0100
@@ -1,24 +0,0 @@
-Metadata-Version: 1.1
-Name: python-slugify
-Version: 1.2.5
-Summary: A Python Slugify application that handles Unicode
-Home-page: https://github.com/un33k/python-slugify
-Author: Val Neekman
-Author-email: [email protected]
-License: MIT
-Description: A Python Slugify application that handles Unicode
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: Topic :: Software Development :: Build Tools
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
-Classifier: Programming Language :: Python :: 3.4
-Classifier: Programming Language :: Python :: 3.5
-Classifier: Programming Language :: Python :: 3.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python-slugify-1.2.5/python_slugify.egg-info/SOURCES.txt
new/python-slugify-2.0.1/python_slugify.egg-info/SOURCES.txt
--- old/python-slugify-1.2.5/python_slugify.egg-info/SOURCES.txt
2018-03-25 17:03:17.000000000 +0200
+++ new/python-slugify-2.0.1/python_slugify.egg-info/SOURCES.txt
1970-01-01 01:00:00.000000000 +0100
@@ -1,14 +0,0 @@
-CHANGELOG.md
-LICENSE
-MANIFEST.in
-README.rst
-setup.cfg
-setup.py
-python_slugify.egg-info/PKG-INFO
-python_slugify.egg-info/SOURCES.txt
-python_slugify.egg-info/dependency_links.txt
-python_slugify.egg-info/entry_points.txt
-python_slugify.egg-info/requires.txt
-python_slugify.egg-info/top_level.txt
-slugify/__init__.py
-slugify/slugify.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python-slugify-1.2.5/python_slugify.egg-info/dependency_links.txt
new/python-slugify-2.0.1/python_slugify.egg-info/dependency_links.txt
--- old/python-slugify-1.2.5/python_slugify.egg-info/dependency_links.txt
2018-03-25 17:03:17.000000000 +0200
+++ new/python-slugify-2.0.1/python_slugify.egg-info/dependency_links.txt
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python-slugify-1.2.5/python_slugify.egg-info/entry_points.txt
new/python-slugify-2.0.1/python_slugify.egg-info/entry_points.txt
--- old/python-slugify-1.2.5/python_slugify.egg-info/entry_points.txt
2018-03-25 17:03:17.000000000 +0200
+++ new/python-slugify-2.0.1/python_slugify.egg-info/entry_points.txt
1970-01-01 01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-[console_scripts]
-slugify = slugify.slugify:main
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python-slugify-1.2.5/python_slugify.egg-info/requires.txt
new/python-slugify-2.0.1/python_slugify.egg-info/requires.txt
--- old/python-slugify-1.2.5/python_slugify.egg-info/requires.txt
2018-03-25 17:03:17.000000000 +0200
+++ new/python-slugify-2.0.1/python_slugify.egg-info/requires.txt
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-Unidecode>=0.04.16
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python-slugify-1.2.5/python_slugify.egg-info/top_level.txt
new/python-slugify-2.0.1/python_slugify.egg-info/top_level.txt
--- old/python-slugify-1.2.5/python_slugify.egg-info/top_level.txt
2018-03-25 17:03:17.000000000 +0200
+++ new/python-slugify-2.0.1/python_slugify.egg-info/top_level.txt
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-slugify
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/requirements.txt
new/python-slugify-2.0.1/requirements.txt
--- old/python-slugify-1.2.5/requirements.txt 1970-01-01 01:00:00.000000000
+0100
+++ new/python-slugify-2.0.1/requirements.txt 2019-01-04 00:03:36.000000000
+0100
@@ -0,0 +1 @@
+Unidecode>=0.04.16
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/requirements_alt.txt
new/python-slugify-2.0.1/requirements_alt.txt
--- old/python-slugify-1.2.5/requirements_alt.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/python-slugify-2.0.1/requirements_alt.txt 2019-01-04
00:03:36.000000000 +0100
@@ -0,0 +1 @@
+text-unidecode>=1.2
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/setup.cfg
new/python-slugify-2.0.1/setup.cfg
--- old/python-slugify-1.2.5/setup.cfg 2018-03-25 17:03:17.000000000 +0200
+++ new/python-slugify-2.0.1/setup.cfg 2019-01-04 00:03:36.000000000 +0100
@@ -1,7 +1,2 @@
[bdist_wheel]
-universal = 1
-
-[egg_info]
-tag_build =
-tag_date = 0
-
+universal=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/setup.py
new/python-slugify-2.0.1/setup.py
--- old/python-slugify-1.2.5/setup.py 2018-03-25 16:58:19.000000000 +0200
+++ new/python-slugify-2.0.1/setup.py 2019-01-04 00:03:36.000000000 +0100
@@ -7,6 +7,11 @@
import sys
import codecs
+install_requires = []
+try:
+ import text_unidecode
+except ImportError:
+ install_requires.append('Unidecode>=0.04.16')
name = 'python-slugify'
package = 'slugify'
@@ -15,10 +20,7 @@
author = 'Val Neekman'
author_email = '[email protected]'
license = 'MIT'
-if "SLUGIFY_USES_TEXT_UNIDECODE" 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/slugify/__init__.py
new/python-slugify-2.0.1/slugify/__init__.py
--- old/python-slugify-1.2.5/slugify/__init__.py 2018-03-25
16:01:31.000000000 +0200
+++ new/python-slugify-2.0.1/slugify/__init__.py 2019-01-04
00:03:36.000000000 +0100
@@ -3,4 +3,4 @@
__author__ = 'Val Neekman @ Neekware Inc. [@vneekman]'
__description__ = 'A Python slugify application that also handles Unicode'
-__version__ = '1.2.5'
+__version__ = '2.0.1'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/slugify/slugify.py
new/python-slugify-2.0.1/slugify/slugify.py
--- old/python-slugify-1.2.5/slugify/slugify.py 2018-03-25 16:57:02.000000000
+0200
+++ new/python-slugify-2.0.1/slugify/slugify.py 2019-01-04 00:03:36.000000000
+0100
@@ -21,22 +21,23 @@
__all__ = ['slugify', 'smart_truncate']
-CHAR_ENTITY_PATTERN = re.compile('&(%s);' % '|'.join(name2codepoint))
-DECIMAL_PATTERN = re.compile('&#(\d+);')
-HEX_PATTERN = re.compile('&#x([\da-fA-F]+);')
+CHAR_ENTITY_PATTERN = re.compile(r'&(%s);' % '|'.join(name2codepoint))
+DECIMAL_PATTERN = re.compile(r'&#(\d+);')
+HEX_PATTERN = re.compile(r'&#x([\da-fA-F]+);')
QUOTE_PATTERN = re.compile(r'[\']+')
ALLOWED_CHARS_PATTERN = re.compile(r'[^-a-z0-9]+')
-DUPLICATE_DASH_PATTERN = re.compile('-{2,}')
-NUMBERS_PATTERN = re.compile('(?<=\d),(?=\d)')
+ALLOWED_CHARS_PATTERN_WITH_UPPERCASE = re.compile(r'[^-a-zA-Z0-9]+')
+DUPLICATE_DASH_PATTERN = re.compile(r'-{2,}')
+NUMBERS_PATTERN = re.compile(r'(?<=\d),(?=\d)')
DEFAULT_SEPARATOR = '-'
-def smart_truncate(string, max_length=0, word_boundaries=False, separator=' ',
save_order=False):
+def smart_truncate(string, max_length=0, word_boundary=False, separator=' ',
save_order=False):
"""
Truncate a string.
:param string (str): string for modification
:param max_length (int): output string length
- :param word_boundaries (bool):
+ :param word_boundary (bool):
:param save_order (bool): if True then word order of output string is like
input string
:param separator (str): separator between words
:return:
@@ -50,7 +51,7 @@
if len(string) < max_length:
return string
- if not word_boundaries:
+ if not word_boundary:
return string[:max_length].strip(separator)
if separator not in string:
@@ -74,7 +75,8 @@
def slugify(text, entities=True, decimal=True, hexadecimal=True, max_length=0,
word_boundary=False,
- separator=DEFAULT_SEPARATOR, save_order=False, stopwords=(),
regex_pattern=None):
+ separator=DEFAULT_SEPARATOR, save_order=False, stopwords=(),
regex_pattern=None, lowercase=True,
+ replacements=()):
"""
Make a slug from the given text.
:param text (str): initial text
@@ -87,9 +89,16 @@
:param separator (str): separator between words
:param stopwords (iterable): words to discount
:param regex_pattern (str): regex pattern for allowed characters
+ :param lowercase (bool): activate case sensitivity by setting it to False
+ :param replacements (iterable): list of replacement rules e.g. [['|',
'or'], ['%', 'percent']]
:return (str):
"""
+ # user-specific replacements
+ if replacements:
+ for old, new in replacements:
+ text = text.replace(old, new)
+
# ensure text is unicode
if not isinstance(text, _unicode_type):
text = _unicode(text, 'utf-8', 'ignore')
@@ -127,8 +136,9 @@
if sys.version_info < (3,):
text = text.encode('ascii', 'ignore')
- # make the text lowercase
- text = text.lower()
+ # make the text lowercase (optional)
+ if lowercase:
+ text = text.lower()
# remove generated quotes -- post-process
text = QUOTE_PATTERN.sub('', text)
@@ -137,7 +147,10 @@
text = NUMBERS_PATTERN.sub('', text)
# replace all other unwanted characters
- pattern = regex_pattern or ALLOWED_CHARS_PATTERN
+ if lowercase:
+ pattern = regex_pattern or ALLOWED_CHARS_PATTERN
+ else:
+ pattern = regex_pattern or ALLOWED_CHARS_PATTERN_WITH_UPPERCASE
text = re.sub(pattern, DEFAULT_SEPARATOR, text)
# remove redundant
@@ -145,10 +158,18 @@
# remove stopwords
if stopwords:
- stopwords_lower = [s.lower() for s in stopwords]
- words = [w for w in text.split(DEFAULT_SEPARATOR) if w not in
stopwords_lower]
+ if lowercase:
+ stopwords_lower = [s.lower() for s in stopwords]
+ words = [w for w in text.split(DEFAULT_SEPARATOR) if w not in
stopwords_lower]
+ else:
+ words = [w for w in text.split(DEFAULT_SEPARATOR) if w not in
stopwords]
text = DEFAULT_SEPARATOR.join(words)
+ # finalize user-specific replacements
+ if replacements:
+ for old, new in replacements:
+ text = text.replace(old, new)
+
# smart truncate if requested
if max_length > 0:
text = smart_truncate(text, max_length, word_boundary,
DEFAULT_SEPARATOR, save_order)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-slugify-1.2.5/test.py
new/python-slugify-2.0.1/test.py
--- old/python-slugify-1.2.5/test.py 1970-01-01 01:00:00.000000000 +0100
+++ new/python-slugify-2.0.1/test.py 2019-01-04 00:03:36.000000000 +0100
@@ -0,0 +1,229 @@
+# -*- coding: utf-8 -*-
+
+import unittest
+from slugify import slugify
+from slugify import smart_truncate
+
+
+class TestSlugification(unittest.TestCase):
+
+ def test_extraneous_seperators(self):
+
+ txt = "This is a test ---"
+ r = slugify(txt)
+ self.assertEqual(r, "this-is-a-test")
+
+ txt = "___This is a test ---"
+ r = slugify(txt)
+ self.assertEqual(r, "this-is-a-test")
+
+ txt = "___This is a test___"
+ r = slugify(txt)
+ self.assertEqual(r, "this-is-a-test")
+
+ def test_non_word_characters(self):
+ txt = "This -- is a ## test ---"
+ r = slugify(txt)
+ self.assertEqual(r, "this-is-a-test")
+
+ def test_phonetic_conversion_of_eastern_scripts(self):
+ txt = '影師嗎'
+ r = slugify(txt)
+ self.assertEqual(r, "ying-shi-ma")
+
+ def test_accented_text(self):
+ txt = 'C\'est déjà l\'été.'
+ r = slugify(txt)
+ self.assertEqual(r, "c-est-deja-l-ete")
+
+ txt = 'Nín hǎo. Wǒ shì zhōng guó rén'
+ r = slugify(txt)
+ self.assertEqual(r, "nin-hao-wo-shi-zhong-guo-ren")
+
+ def test_accented_text_with_non_word_characters(self):
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt)
+ self.assertEqual(r, "jaja-lol-mememeoo-a")
+
+ def test_cyrillic_text(self):
+ txt = 'Компьютер'
+ r = slugify(txt)
+ self.assertEqual(r, "kompiuter")
+
+ def test_max_length(self):
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt, max_length=9)
+ self.assertEqual(r, "jaja-lol")
+
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt, max_length=15)
+ self.assertEqual(r, "jaja-lol-mememe")
+
+ def test_max_length_cutoff_not_required(self):
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt, max_length=50)
+ self.assertEqual(r, "jaja-lol-mememeoo-a")
+
+ def test_word_boundary(self):
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt, max_length=15, word_boundary=True)
+ self.assertEqual(r, "jaja-lol-a")
+
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt, max_length=17, word_boundary=True)
+ self.assertEqual(r, "jaja-lol-mememeoo")
+
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt, max_length=18, word_boundary=True)
+ self.assertEqual(r, "jaja-lol-mememeoo")
+
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt, max_length=19, word_boundary=True)
+ self.assertEqual(r, "jaja-lol-mememeoo-a")
+
+ def test_custom_separator(self):
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt, max_length=20, word_boundary=True, separator=".")
+ self.assertEqual(r, "jaja.lol.mememeoo.a")
+
+ def test_multi_character_separator(self):
+ txt = 'jaja---lol-méméméoo--a'
+ r = slugify(txt, max_length=20, word_boundary=True, separator="ZZZZZZ")
+ self.assertEqual(r, "jajaZZZZZZlolZZZZZZmememeooZZZZZZa")
+
+ def test_save_order(self):
+ txt = 'one two three four five'
+ r = slugify(txt, max_length=13, word_boundary=True, save_order=True)
+ self.assertEqual(r, "one-two-three")
+
+ txt = 'one two three four five'
+ r = slugify(txt, max_length=13, word_boundary=True, save_order=False)
+ self.assertEqual(r, "one-two-three")
+
+ txt = 'one two three four five'
+ r = slugify(txt, max_length=12, word_boundary=True, save_order=False)
+ self.assertEqual(r, "one-two-four")
+
+ txt = 'one two three four five'
+ r = slugify(txt, max_length=12, word_boundary=True, save_order=True)
+ self.assertEqual(r, "one-two")
+
+ def test_stopword_removal(self):
+ txt = 'this has a stopword'
+ r = slugify(txt, stopwords=['stopword'])
+ self.assertEqual(r, 'this-has-a')
+
+ def test_stopword_removal_casesensitive(self):
+ txt = 'thIs Has a stopword Stopword'
+ r = slugify(txt, stopwords=['Stopword'], lowercase=False)
+ self.assertEqual(r, 'thIs-Has-a-stopword')
+
+ def test_multiple_stopword_occurances(self):
+ txt = 'the quick brown fox jumps over the lazy dog'
+ r = slugify(txt, stopwords=['the'])
+ self.assertEqual(r, 'quick-brown-fox-jumps-over-lazy-dog')
+
+ def test_differently_cased_stopword_match(self):
+ txt = 'Foo A FOO B foo C'
+ r = slugify(txt, stopwords=['foo'])
+ self.assertEqual(r, 'a-b-c')
+
+ txt = 'Foo A FOO B foo C'
+ r = slugify(txt, stopwords=['FOO'])
+ self.assertEqual(r, 'a-b-c')
+
+ def test_multiple_stopwords(self):
+ txt = 'the quick brown fox jumps over the lazy dog in a hurry'
+ r = slugify(txt, stopwords=['the', 'in', 'a', 'hurry'])
+ self.assertEqual(r, 'quick-brown-fox-jumps-over-lazy-dog')
+
+ def test_stopwords_with_different_separator(self):
+ txt = 'the quick brown fox jumps over the lazy dog'
+ r = slugify(txt, stopwords=['the'], separator=' ')
+ self.assertEqual(r, 'quick brown fox jumps over lazy dog')
+
+ def test_html_entities(self):
+ txt = 'foo & bar'
+ r = slugify(txt)
+ self.assertEqual(r, 'foo-bar')
+
+ def test_starts_with_number(self):
+ txt = '10 amazing secrets'
+ r = slugify(txt)
+ self.assertEqual(r, '10-amazing-secrets')
+
+ def test_contains_numbers(self):
+ txt = 'buildings with 1000 windows'
+ r = slugify(txt)
+ self.assertEqual(r, 'buildings-with-1000-windows')
+
+ def test_ends_with_number(self):
+ txt = 'recipe number 3'
+ r = slugify(txt)
+ self.assertEqual(r, 'recipe-number-3')
+
+ def test_numbers_only(self):
+ txt = '404'
+ r = slugify(txt)
+ self.assertEqual(r, '404')
+
+ def test_numbers_and_symbols(self):
+ txt = '1,000 reasons you are #1'
+ r = slugify(txt)
+ self.assertEqual(r, '1000-reasons-you-are-1')
+
+ def test_regex_pattern_keep_underscore(self):
+ txt = "___This is a test___"
+ regex_pattern = r'[^-a-z0-9_]+'
+ r = slugify(txt, regex_pattern=regex_pattern)
+ self.assertEqual(r, "___this-is-a-test___")
+
+ def test_regex_pattern_keep_underscore_with_underscore_as_separator(self):
+ """
+ The regex_pattern turns the power to the caller.
+ Hence the caller must ensure that a custom separator doesn't clash
+ with the regex_pattern.
+ """
+ txt = "___This is a test___"
+ regex_pattern = r'[^-a-z0-9_]+'
+ r = slugify(txt, separator='_', regex_pattern=regex_pattern)
+ self.assertNotEqual(r, "_this_is_a_test_")
+
+ def test_replacements(self):
+ txt = '10 | 20 %'
+ r = slugify(txt, replacements=[['|', 'or'], ['%', 'percent']])
+ self.assertEqual(r, "10-or-20-percent")
+
+ txt = 'I ♥ 🦄'
+ r = slugify(txt, replacements=[['♥', 'amour'], ['🦄', 'licorne']])
+ self.assertEqual(r, "i-amour-licorne")
+
+
+class TestUtils(unittest.TestCase):
+
+ def test_smart_truncate_no_max_length(self):
+ txt = '1,000 reasons you are #1'
+ r = smart_truncate(txt)
+ self.assertEqual(r, txt)
+
+ def test_smart_truncate_no_seperator(self):
+ txt = '1,000 reasons you are #1'
+ r = smart_truncate(txt, max_length=100, separator='_')
+ self.assertEqual(r, txt)
+
+
+class TestUtils(unittest.TestCase):
+
+ def test_smart_truncate_no_max_length(self):
+ txt = '1,000 reasons you are #1'
+ r = smart_truncate(txt)
+ self.assertEqual(r, txt)
+
+ def test_smart_truncate_no_seperator(self):
+ txt = '1,000 reasons you are #1'
+ r = smart_truncate(txt, max_length=100, separator='_')
+ self.assertEqual(r, txt)
+
+
+if __name__ == '__main__':
+ unittest.main()