Source

suds python 3 patches / extract-version-information

# HG changeset patch
# Parent 99648b8a89bfdb3a3ef781788f97b7dd0b3434be
Extract suds version information into a separate module.

This change allows the setup.py script to work without having to import the
suds package, thus allowing us to:
  * Maintain our suds library sources in Python 2 compatible but possibly Python
    3 incompatible format (whatever gets imported by setup.py needs to be
    compatible with the Python version running that script).
  * Have setup.py install any missing suds library depencencies instead of
    depending on them itself and requiring them to be installed manually before
    hand.

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -16,12 +16,24 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 # written by: Jeff Ortel ( jortel@redhat.com )
 
-import suds
+import os.path
 from setuptools import setup, find_packages
 
+# Load the suds library version information directly into this module without
+# having to import the whole suds library itself. Importing the suds package
+# would have caused problems like the following:
+#   * Forcing the imported package module to be Python 3 compatible without any
+#     lib2to3 fixers first being run on it (since such fixers get run only
+#     later as a part of the setup procedure).
+#   * Making the setup module depend on the package module's dependencies, thus
+#     forcing the user to install them manually (since the setup procedure that
+#     is supposed to install them automatically will not be able to run unless
+#     they are already installed).
+exec(open(os.path.join("suds", "version.py"), "rt").read())
+
 setup(
     name="suds",
-    version=suds.__version__,
+    version=__version__,
     description="Lightweight SOAP client",
     author="Jeff Ortel",
     author_email="jortel@redhat.com",
diff --git a/suds/__init__.py b/suds/__init__.py
--- a/suds/__init__.py
+++ b/suds/__init__.py
@@ -23,8 +23,7 @@
 # Project properties
 #
 
-__version__ = '0.4.1'
-__build__="(beta) R705-20101207"
+from version import __build__, __version__
 
 #
 # Exceptions
diff --git a/suds/version.py b/suds/version.py
new file mode 100644
--- /dev/null
+++ b/suds/version.py
@@ -0,0 +1,25 @@
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the (LGPL) GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Library Lesser General Public License for more details at
+# ( http://www.gnu.org/licenses/lgpl.html ).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+"""
+Module containing the library's version information. This version information
+has been extracted into a separate file so it can be read from the setup.py
+script without having to import the suds package itself. See the setup.py
+script for more detailed information.
+
+"""
+
+__version__ = '0.4.1'
+__build__ = "(beta) R705-20101207"