From 77620b8a54890ce0c4af853c1afc7714f7ce9a28 Mon Sep 17 00:00:00 2001 From: Ian McLeod Date: Thu, 24 Jul 2014 11:58:20 -0500 Subject: [PATCH 1/9] changes to comply with Fedora package standard Full details can be found in the package review ticket here: https://bugzilla.redhat.com/show_bug.cgi?id=1123044 --- MANIFEST.in | 2 +- README.rpm-generation | 43 +++++++++++++++++++++++++++ pyrax.spec.in => python-pyrax.spec.in | 36 ++++++++++------------ setup.py | 12 ++++++-- 4 files changed, 69 insertions(+), 24 deletions(-) create mode 100644 README.rpm-generation rename pyrax.spec.in => python-pyrax.spec.in (54%) diff --git a/MANIFEST.in b/MANIFEST.in index e4945b07..d5a43774 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include README.md RELEASENOTES.md +include README.md RELEASENOTES.md COPYING recursive-include docs *.md recursive-include samples *.py recursive-include tests *.py diff --git a/README.rpm-generation b/README.rpm-generation new file mode 100644 index 00000000..b159b39f --- /dev/null +++ b/README.rpm-generation @@ -0,0 +1,43 @@ +* Notes related to RPM generation + +You can generate an RPM from the upstream pyrax source tree by running: + +$ make rpms + +This will generate a distribution tarball by running: + +$ python setup.py sdist + +Code within setup.py creates a SPEC file with the version and release +replaced from the SPEC template "python-pyrax.spec.in" + +Details of how the release string is generated can be found in setup.py. + +Generally speaking, during development the release string should be "0". +This allows frequent rebuilds of the RPMs and will generate a timestamp +based release that is always "newer" for more recent rebuilds. + +When doing a formal upstream release the "release" string can be set +to any non-zero value. This will turn off the generation of additional +time and git-based release string content. + +* Snapshot Packages + +If you need to generate an RPM that is not based on an entirely unmodified +upstream source release, you should set "snapshot_release" to True. +This will generate a release suffix based on the date and git hash that +meets the Fedora package guidelines presented here: + +http://fedoraproject.org/wiki/Packaging:NamingGuidelines#Snapshot_packages + +(Note from imcleod@redhat.com - Monday, July 28, 2014 + +We are working to get pyrax into the Fedora package set. Our submission +is in bugzilla here: + +https://bugzilla.redhat.com/show_bug.cgi?id=1123044 + +Until we can coordinate releases regularly with upstream, I will be doing +snapshot package generation as described above. I will fork upstream at +the point of release and then set the RPM version and release details as +needed to generate a package.) diff --git a/pyrax.spec.in b/python-pyrax.spec.in similarity index 54% rename from pyrax.spec.in rename to python-pyrax.spec.in index 9ee13598..fc41ec29 100644 --- a/pyrax.spec.in +++ b/python-pyrax.spec.in @@ -1,19 +1,20 @@ -%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} - -Name: pyrax +Name: python-pyrax Version: @VERSION@ Release: @RELEASE@%{?dist} Summary: Python language bindings for OpenStack Clouds -License: ASLv2 -URL: https://github.com/rackerlabs/pyrax -Source0: %{name}-%{version}.tar.gz +License: ASL 2.0 +Source0: http://imcleod.fedorapeople.org/src/pyrax/pyrax-%{version}.tar.gz +URL: https://github.com/rackspace/pyrax + +# Earlier upstream RPMs had the name pyrax - provide this for compatibility +Provides: pyrax = %{version} BuildArch: noarch BuildRequires: python-setuptools BuildRequires: python-mock +BuildRequires: python2-devel Requires: python-novaclient >= 2.13.0 -Requires: python-swiftclient >= 1.5.0 Requires: python-httplib2 Requires: python-keyring @@ -26,18 +27,8 @@ network, even though CDN support is not part of OpenStack Swift. But if you don't use any of the CDN-related code, your app will work fine on any standard Swift deployment. - -%package rackspace -Summary: Bring in the bits that work with Rackspace's Cloud -Requires: pyrax -Requires: rackspace-novaclient - -%description rackspace -The Rackspace Cloud has additional libraries that are required to access -all the things. This package just makes sure they are available for pyrax. - %prep -%setup -q +%setup -q -n pyrax-%{version} %build @@ -45,12 +36,15 @@ all the things. This package just makes sure they are available for pyrax. %install rm -rf $RPM_BUILD_ROOT -%{__python} setup.py install --root $RPM_BUILD_ROOT +%{__python2} setup.py install --root $RPM_BUILD_ROOT %files -%{python_sitelib}/* -#%{_bindir}/ +%doc README COPYING samples docs +%{python2_sitelib}/* %changelog +* Thu Jul 24 2014 Ian McLeod - 1.9.0-1 +- Pull in upstream 1.9.0 release + * Fri Sep 6 2013 Greg Swift - 1.5.0-1 - Initial spec diff --git a/setup.py b/setup.py index 941c891e..bc365e60 100755 --- a/setup.py +++ b/setup.py @@ -23,6 +23,10 @@ # Set to another value when cutting official release RPMS, then change back to # zero for the next development cycle release = '0' +# At the moment we are doing this in a fork so every release is strictly speaking +# a snapshot. Set this to false _and_ set above release to a non-zero value to +# get short "normal" release strings +snapshot_release = True class sdist(_sdist): """ custom sdist command, to prep pyrax.spec file """ @@ -37,10 +41,12 @@ def run(self): stdout=subprocess.PIPE).communicate()[0].strip() date = time.strftime("%Y%m%d%H%M%S", time.gmtime()) git_release = "%sgit%s" % (date, git_head) + shortdate = time.strftime("%Y%m%d", time.gmtime()) + snapshot_git_release = "%sgit%s" % (shortdate, git_head) # Expand macros in pyrax.spec.in - spec_in = open('pyrax.spec.in', 'r') - spec = open('pyrax.spec', 'w') + spec_in = open('python-pyrax.spec.in', 'r') + spec = open('python-pyrax.spec', 'w') for line in spec_in.xreadlines(): if "@VERSION@" in line: line = line.replace("@VERSION@", version) @@ -48,6 +54,8 @@ def run(self): # If development release, include date+githash in %{release} if release.startswith('0'): release += '.' + git_release + elif snapshot_release: + release += '.' + snapshot_git_release line = line.replace("@RELEASE@", release) spec.write(line) spec_in.close() From 05e4b8c57c364206d0bc8fc04df8681bc988062f Mon Sep 17 00:00:00 2001 From: Ian McLeod Date: Fri, 25 Jul 2014 16:33:27 -0500 Subject: [PATCH 2/9] add inline license for slugify() function to satisfy 3-clause BSD requirements from django --- pyrax/utils.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/pyrax/utils.py b/pyrax/utils.py index 88e19c7b..1f88e1d9 100644 --- a/pyrax/utils.py +++ b/pyrax/utils.py @@ -712,7 +712,37 @@ def import_class(import_str): __import__(mod_str) return getattr(sys.modules[mod_str], class_str) - +# Code below is originally from django +# Django is 3-clause BSD, which we'll duplicate here to be safe +# +#Copyright (c) Django Software Foundation and individual contributors. +#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 Django 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. +# # http://code.activestate.com/recipes/ # 577257-slugify-make-a-string-usable-in-a-url-or-filename/ def slugify(value): From 2c89bfca1c7d54f5e01391ce6c6b0520df354482 Mon Sep 17 00:00:00 2001 From: Ian McLeod Date: Mon, 28 Jul 2014 13:34:55 -0500 Subject: [PATCH 3/9] release string change for formal 1.9.0 based RPM --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bc365e60..8f6035a2 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ # When set to '0' this expands in the RPM SPEC file to a unique date-base string # Set to another value when cutting official release RPMS, then change back to # zero for the next development cycle -release = '0' +release = '1' # At the moment we are doing this in a fork so every release is strictly speaking # a snapshot. Set this to false _and_ set above release to a non-zero value to # get short "normal" release strings From fc47130358d2d82acdff7ed42a692cc1608dd0f5 Mon Sep 17 00:00:00 2001 From: Ian McLeod Date: Fri, 25 Jul 2014 16:02:45 -0500 Subject: [PATCH 4/9] Remove #! execution headers for non-executable components --- pyrax/__init__.py | 1 - pyrax/autoscale.py | 1 - pyrax/base_identity.py | 1 - pyrax/client.py | 1 - pyrax/cloudblockstorage.py | 1 - pyrax/clouddatabases.py | 1 - pyrax/clouddns.py | 1 - pyrax/cloudloadbalancers.py | 1 - pyrax/cloudmonitoring.py | 1 - pyrax/cloudnetworks.py | 1 - pyrax/exceptions.py | 1 - pyrax/fakes.py | 1 - pyrax/identity/__init__.py | 1 - pyrax/identity/keystone_identity.py | 1 - pyrax/identity/rax_identity.py | 1 - pyrax/image.py | 1 - pyrax/object_storage.py | 1 - pyrax/queueing.py | 1 - pyrax/utils.py | 1 - pyrax/version.py | 1 - 20 files changed, 20 deletions(-) diff --git a/pyrax/__init__.py b/pyrax/__init__.py index b63526e5..0f6a385e 100755 --- a/pyrax/__init__.py +++ b/pyrax/__init__.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c)2012 Rackspace US, Inc. diff --git a/pyrax/autoscale.py b/pyrax/autoscale.py index 91fab8e3..e510057e 100644 --- a/pyrax/autoscale.py +++ b/pyrax/autoscale.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c)2013 Rackspace US, Inc. diff --git a/pyrax/base_identity.py b/pyrax/base_identity.py index 580decbc..6c717e9d 100644 --- a/pyrax/base_identity.py +++ b/pyrax/base_identity.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- diff --git a/pyrax/client.py b/pyrax/client.py index 0b8ab0a3..9b6472bd 100644 --- a/pyrax/client.py +++ b/pyrax/client.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2010 Jacob Kaplan-Moss diff --git a/pyrax/cloudblockstorage.py b/pyrax/cloudblockstorage.py index 9d13678a..86dd18dd 100644 --- a/pyrax/cloudblockstorage.py +++ b/pyrax/cloudblockstorage.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c)2012 Rackspace US, Inc. diff --git a/pyrax/clouddatabases.py b/pyrax/clouddatabases.py index 0350c54a..dcb61907 100644 --- a/pyrax/clouddatabases.py +++ b/pyrax/clouddatabases.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c)2012 Rackspace US, Inc. diff --git a/pyrax/clouddns.py b/pyrax/clouddns.py index f2160595..5e0cd120 100644 --- a/pyrax/clouddns.py +++ b/pyrax/clouddns.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c)2012 Rackspace US, Inc. diff --git a/pyrax/cloudloadbalancers.py b/pyrax/cloudloadbalancers.py index 1af39642..f61b1313 100644 --- a/pyrax/cloudloadbalancers.py +++ b/pyrax/cloudloadbalancers.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c)2012 Rackspace US, Inc. diff --git a/pyrax/cloudmonitoring.py b/pyrax/cloudmonitoring.py index b1b5489a..07e02c40 100644 --- a/pyrax/cloudmonitoring.py +++ b/pyrax/cloudmonitoring.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c)2013 Rackspace US, Inc. diff --git a/pyrax/cloudnetworks.py b/pyrax/cloudnetworks.py index 43713d62..1484a75c 100644 --- a/pyrax/cloudnetworks.py +++ b/pyrax/cloudnetworks.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c)2013 Rackspace US, Inc. diff --git a/pyrax/exceptions.py b/pyrax/exceptions.py index c73af611..8846e2ad 100644 --- a/pyrax/exceptions.py +++ b/pyrax/exceptions.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c)2012 Rackspace US, Inc. diff --git a/pyrax/fakes.py b/pyrax/fakes.py index 45909007..d36fbf05 100644 --- a/pyrax/fakes.py +++ b/pyrax/fakes.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- import json import os diff --git a/pyrax/identity/__init__.py b/pyrax/identity/__init__.py index f5ae2162..e53c0d93 100644 --- a/pyrax/identity/__init__.py +++ b/pyrax/identity/__init__.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- import glob diff --git a/pyrax/identity/keystone_identity.py b/pyrax/identity/keystone_identity.py index 323dcc40..fe9893f6 100644 --- a/pyrax/identity/keystone_identity.py +++ b/pyrax/identity/keystone_identity.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import diff --git a/pyrax/identity/rax_identity.py b/pyrax/identity/rax_identity.py index 741bca38..648197d9 100644 --- a/pyrax/identity/rax_identity.py +++ b/pyrax/identity/rax_identity.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import diff --git a/pyrax/image.py b/pyrax/image.py index c5c61bb7..3f1fca68 100644 --- a/pyrax/image.py +++ b/pyrax/image.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c)2014 Rackspace US, Inc. diff --git a/pyrax/object_storage.py b/pyrax/object_storage.py index 5e47d9bf..815da17c 100644 --- a/pyrax/object_storage.py +++ b/pyrax/object_storage.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2014 Rackspace diff --git a/pyrax/queueing.py b/pyrax/queueing.py index bd913595..3199b172 100644 --- a/pyrax/queueing.py +++ b/pyrax/queueing.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c)2012 Rackspace US, Inc. diff --git a/pyrax/utils.py b/pyrax/utils.py index 1f88e1d9..feb73b34 100644 --- a/pyrax/utils.py +++ b/pyrax/utils.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function diff --git a/pyrax/version.py b/pyrax/version.py index ab7d7141..f624bd43 100644 --- a/pyrax/version.py +++ b/pyrax/version.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- version = "1.9.0" From b3b5f09969113a0c08018f76a0cede04908a29cb Mon Sep 17 00:00:00 2001 From: Ian McLeod Date: Mon, 28 Jul 2014 13:48:58 -0500 Subject: [PATCH 5/9] remove httplib2 requires from SPEC --- python-pyrax.spec.in | 1 - 1 file changed, 1 deletion(-) diff --git a/python-pyrax.spec.in b/python-pyrax.spec.in index fc41ec29..e84d7892 100644 --- a/python-pyrax.spec.in +++ b/python-pyrax.spec.in @@ -15,7 +15,6 @@ BuildRequires: python-setuptools BuildRequires: python-mock BuildRequires: python2-devel Requires: python-novaclient >= 2.13.0 -Requires: python-httplib2 Requires: python-keyring From 41b2e04cb084f118ad2f05e58129ab2d3cd60ad2 Mon Sep 17 00:00:00 2001 From: Ian McLeod Date: Mon, 28 Jul 2014 15:34:18 -0500 Subject: [PATCH 6/9] updates for downstream 1.9.0-2 release This finalizes changes required to meet Fedora package requirements and tags the resulting RPM as 1.9.0-2, including a meaningful changelog entry. When merging this upstream please preserve the changelog. --- python-pyrax.spec.in | 6 ++++++ setup.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/python-pyrax.spec.in b/python-pyrax.spec.in index e84d7892..c1870a05 100644 --- a/python-pyrax.spec.in +++ b/python-pyrax.spec.in @@ -42,6 +42,12 @@ rm -rf $RPM_BUILD_ROOT %{python2_sitelib}/* %changelog +* Mon Jul 28 2014 Ian McLeod - 1.9.0-2 +- Remove obsolete httplib requirement from SPEC file +- Remove #! execution headers for non-executable components [BZ1123044] +- add inline license for slugify() function to satisfy 3-clause BSD requirements from django [BZ1123044] +- misc additional SPEC change to comply with Fedora package guidelines [BZ1123044] + * Thu Jul 24 2014 Ian McLeod - 1.9.0-1 - Pull in upstream 1.9.0 release diff --git a/setup.py b/setup.py index 8f6035a2..03030fe1 100755 --- a/setup.py +++ b/setup.py @@ -22,11 +22,11 @@ # When set to '0' this expands in the RPM SPEC file to a unique date-base string # Set to another value when cutting official release RPMS, then change back to # zero for the next development cycle -release = '1' +release = '2' # At the moment we are doing this in a fork so every release is strictly speaking # a snapshot. Set this to false _and_ set above release to a non-zero value to # get short "normal" release strings -snapshot_release = True +snapshot_release = False class sdist(_sdist): """ custom sdist command, to prep pyrax.spec file """ From 7178f958d22679709620b2f8e848f48019f92e63 Mon Sep 17 00:00:00 2001 From: Ian McLeod Date: Tue, 29 Jul 2014 16:30:12 -0500 Subject: [PATCH 7/9] epel 6 SPEC fix --- python-pyrax.spec.in | 9 +++++++++ setup.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/python-pyrax.spec.in b/python-pyrax.spec.in index c1870a05..589629c6 100644 --- a/python-pyrax.spec.in +++ b/python-pyrax.spec.in @@ -1,3 +1,9 @@ +# The python2 defines are missing in RHEL6 +%if 0%{?rhel} == 6 +%define __python2 %{__python} +%define python2_sitelib %{python_sitelib} +%endif + Name: python-pyrax Version: @VERSION@ Release: @RELEASE@%{?dist} @@ -42,6 +48,9 @@ rm -rf $RPM_BUILD_ROOT %{python2_sitelib}/* %changelog +* Tue Jul 29 2014 Ian McLeod - 1.9.0-3 +- SPEC change to add missing macros for EPEL 6 builds + * Mon Jul 28 2014 Ian McLeod - 1.9.0-2 - Remove obsolete httplib requirement from SPEC file - Remove #! execution headers for non-executable components [BZ1123044] diff --git a/setup.py b/setup.py index 03030fe1..1e240f38 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ # When set to '0' this expands in the RPM SPEC file to a unique date-base string # Set to another value when cutting official release RPMS, then change back to # zero for the next development cycle -release = '2' +release = '3' # At the moment we are doing this in a fork so every release is strictly speaking # a snapshot. Set this to false _and_ set above release to a non-zero value to # get short "normal" release strings From 9c8d8eadeb87852203f3bd9c2d718cf3ff86b7f2 Mon Sep 17 00:00:00 2001 From: Ian McLeod Date: Thu, 31 Jul 2014 09:24:19 -0500 Subject: [PATCH 8/9] update version and RPM control variables for ongoing post 1.9.0 development This represents the suggested RPM approach for post-release development. We increment the version but set the RPM release tag to "0" which activates generation of time and git-based RPM release strings. I am assuming a next version of 1.9.1 When 1.9.1 is ready for release, increment the RPM release string to "1" as part of the commit forming the official release. Then, as the first post-release commit, repeat the changes seen in this commit for 1.9.2 (or whatever the appropriate next version will be). --- pyrax/version.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrax/version.py b/pyrax/version.py index f624bd43..0e6eb431 100644 --- a/pyrax/version.py +++ b/pyrax/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -version = "1.9.0" +version = "1.9.1" diff --git a/setup.py b/setup.py index 1e240f38..afde88ce 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ # When set to '0' this expands in the RPM SPEC file to a unique date-base string # Set to another value when cutting official release RPMS, then change back to # zero for the next development cycle -release = '3' +release = '0' # At the moment we are doing this in a fork so every release is strictly speaking # a snapshot. Set this to false _and_ set above release to a non-zero value to # get short "normal" release strings From c93d7e411e70149cbb1c64f207cf6051454cedf6 Mon Sep 17 00:00:00 2001 From: Ian McLeod Date: Thu, 31 Jul 2014 09:41:01 -0500 Subject: [PATCH 9/9] pep compliance change to inline license --- pyrax/utils.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pyrax/utils.py b/pyrax/utils.py index feb73b34..f71ae09f 100644 --- a/pyrax/utils.py +++ b/pyrax/utils.py @@ -714,11 +714,11 @@ def import_class(import_str): # Code below is originally from django # Django is 3-clause BSD, which we'll duplicate here to be safe # -#Copyright (c) Django Software Foundation and individual contributors. -#All rights reserved. +# Copyright (c) Django Software Foundation and individual contributors. +# All rights reserved. # -#Redistribution and use in source and binary forms, with or without modification, -#are permitted provided that the following conditions are met: +# 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. @@ -731,16 +731,16 @@ def import_class(import_str): # 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. +# 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. # # http://code.activestate.com/recipes/ # 577257-slugify-make-a-string-usable-in-a-url-or-filename/