summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml6
-rw-r--r--CHANGELOG.md6
-rw-r--r--LICENSE21
-rw-r--r--LICENSE.md28
-rw-r--r--MANIFEST.in2
-rwxr-xr-xpep8.sh7
-rwxr-xr-xsetup.py5
-rw-r--r--slugify/__init__.py2
-rw-r--r--slugify/slugify.py6
-rw-r--r--test.py13
10 files changed, 54 insertions, 42 deletions
diff --git a/.travis.yml b/.travis.yml
index 863cc24..eb6f274 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,17 +6,19 @@ python:
- "2.7"
- "3.3"
- "3.4"
+ - "3.5"
- pypy
install:
- - pip install -q -r requirements.txt --use-mirrors
+ - pip install pip -U
+ - pip install -q -r requirements.txt
- pip install -e .
- pip install pep8
- pip install coveralls
- pip install https://github.com/un33k/pyflakes/tarball/master
before_script:
- - "pep8 --exclude=migrations --ignore=E501,E225,E128 ."
+ - "bash pep8.sh"
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pyflakes -x W slugify; fi
script: coverage run --source=slugify test.py
diff --git a/CHANGELOG.md b/CHANGELOG.md
index af16f3d..1d2b7c6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 1.2.1
+ - Including certain files (e.g. license.md) in sdists via MANIFEST.in (@proinsias)
+ - Relax licensing by moving from BSD to MIT
+ - Add Python 3.5 support
+ - Add more tests
+
## 1.2.0
Backward incompatible change: (@fabiocaccamo)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..82af695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) Val Neekman @ Neekware Inc. http://neekware.com
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/LICENSE.md b/LICENSE.md
deleted file mode 100644
index f48fab2..0000000
--- a/LICENSE.md
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright © Val Neekman ([Neekware Inc.](http://neekware.com)) [ info@neekware.com, [@vneekman](https://twitter.com/vneekman) ]
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. Neither the name of this project nor the names of its contributors may be
- used to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MANIFEST.in b/MANIFEST.in
index d3063b3..7b74127 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,3 +1,3 @@
-include LICENSE.md
+include LICENSE
include README.md
include requirements.txt
diff --git a/pep8.sh b/pep8.sh
index f48f800..a8e960a 100755
--- a/pep8.sh
+++ b/pep8.sh
@@ -1,14 +1,11 @@
#!/bin/bash
-echo -e "\nRunning: pep8 ... \n"
-
# 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
-pep8 --ignore=E128,E225,E501 slugify test.py setup.py
-
-echo -e "Done.\n"
+pep8 --ignore=E128,E261,E225,E501 slugify test.py setup.py
diff --git a/setup.py b/setup.py
index 46e7d68..068f8af 100755
--- a/setup.py
+++ b/setup.py
@@ -14,12 +14,12 @@ description = 'A Python Slugify application that handles Unicode'
url = 'https://github.com/un33k/python-slugify'
author = 'Val Neekman'
author_email = 'info@neekware.com'
-license = 'BSD'
+license = 'MIT'
install_requires = ['Unidecode>=0.04.16']
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
- 'License :: OSI Approved :: BSD License',
+ 'License :: OSI Approved :: MIT License',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
@@ -28,6 +28,7 @@ classifiers = [
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
]
diff --git a/slugify/__init__.py b/slugify/__init__.py
index 8b20b5f..daaafd8 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.0'
+__version__ = '1.2.1'
diff --git a/slugify/slugify.py b/slugify/slugify.py
index 113afdd..327f2c1 100644
--- a/slugify/slugify.py
+++ b/slugify/slugify.py
@@ -16,7 +16,7 @@ except ImportError:
import unidecode
-__all__ = ['slugify']
+__all__ = ['slugify', 'smart_truncate']
CHAR_ENTITY_PATTERN = re.compile('&(%s);' % '|'.join(name2codepoint))
@@ -65,7 +65,7 @@ def smart_truncate(string, max_length=0, word_boundaries=False, separator=' ', s
else:
if save_order:
break
- if not truncated:
+ if not truncated: # pragma: no cover
truncated = string[:max_length]
return truncated.strip(separator)
@@ -152,7 +152,7 @@ def slugify(text, entities=True, decimal=True, hexadecimal=True, max_length=0, w
return text
-def main():
+def main(): # pragma: no cover
if len(sys.argv) < 2:
print("Usage %s TEXT TO SLUGIFY" % sys.argv[0])
else:
diff --git a/test.py b/test.py
index 5bad955..768fcb9 100644
--- a/test.py
+++ b/test.py
@@ -2,6 +2,7 @@
import unittest
from slugify import slugify
+from slugify import smart_truncate
class TestSlugification(unittest.TestCase):
@@ -167,5 +168,17 @@ class TestSlugification(unittest.TestCase):
self.assertEqual(r, '1000-reasons-you-are-1')
+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()