From 6444deb7b636943f30fb7c9ac79917ccb9e96144 Mon Sep 17 00:00:00 2001
From: Ionut Turturica <jonozzz@yahoo.com>
Date: Wed, 20 Jun 2012 16:20:13 -0700
Subject: [PATCH] Cut off fpconst dependency.

---
 CHANGES.txt               |  2 +-
 README.txt                |  2 --
 setup.py                  |  1 -
 src/SOAPpy/Parser.py      | 13 ++++++-------
 src/SOAPpy/SOAPBuilder.py |  7 +++----
 src/SOAPpy/Types.py       |  4 ++++
 6 files changed, 14 insertions(+), 15 deletions(-)
 mode change 100755 => 100644 src/SOAPpy/SOAPBuilder.py

diff --git a/CHANGES.txt b/CHANGES.txt
index 0eeab65..51b1223 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,7 +3,7 @@ CHANGELOG
 
 0.12.6 (unreleased)
 --------------------
-- Nothing changed yet
+- Remove dependency on fpconst.
 
 0.12.5 (2011-08-01)
 -------------------
diff --git a/README.txt b/README.txt
index 13d8472..e20c051 100644
--- a/README.txt
+++ b/README.txt
@@ -122,8 +122,6 @@ USING GITHUB
 REQUIRED PACKAGES
 ------------------
 
-    - fpconst 0.6.0 or later,
-      <http://research.warnes.net/projects/rzope/fpconst/>
     - wstools
 
 
diff --git a/setup.py b/setup.py
index e0bf13f..7003fe0 100644
--- a/setup.py
+++ b/setup.py
@@ -66,7 +66,6 @@ setup(
     package_dir = {'': 'src'},
     include_package_data=True,
     install_requires=[
-        'fpconst',
         'wstools',
     ]
 )
diff --git a/src/SOAPpy/Parser.py b/src/SOAPpy/Parser.py
index 93da26e..a3127f2 100644
--- a/src/SOAPpy/Parser.py
+++ b/src/SOAPpy/Parser.py
@@ -5,7 +5,6 @@ from NS        import NS
 from Utilities import *
 
 import string
-import fpconst
 import xml.sax
 from wstools.XMLname import fromXMLname
 
@@ -909,22 +908,22 @@ class SOAPParser(xml.sax.handler.ContentHandler):
 
                 # Explicitly check for NaN and Infinities
                 if s == "nan":
-                    d = fpconst.NaN
+                    d = NaN
                 elif s[0:2]=="inf" or s[0:3]=="+inf":
-                    d = fpconst.PosInf
+                    d = PosInf
                 elif s[0:3] == "-inf":
-                    d = fpconst.NegInf
+                    d = NegInf
                 else :
                     d = float(s)
 
                 if config.strict_range:
-                    if fpconst.isNaN(d):
+                    if NaN == d:
                         if s[0:2] != 'nan':
                             raise ValueError, "invalid %s: %s" % (t[1], s)
-                    elif fpconst.isNegInf(d):
+                    elif NegInf == d:
                         if s[0:3] != '-inf':
                             raise UnderflowError, "%s too small: %s" % (t[1], s)
-                    elif fpconst.isPosInf(d):
+                    elif PosInf == d:
                         if s[0:2] != 'inf' and s[0:3] != '+inf':
                             raise OverflowError, "%s too large: %s" % (t[1], s)
                     elif d < 0 and d < l[1]:
diff --git a/src/SOAPpy/SOAPBuilder.py b/src/SOAPpy/SOAPBuilder.py
old mode 100755
new mode 100644
index f2eaee2..baccb91
--- a/src/SOAPpy/SOAPBuilder.py
+++ b/src/SOAPpy/SOAPBuilder.py
@@ -38,7 +38,6 @@ from version import __version__
 
 import cgi
 from wstools.XMLname import toXMLname, fromXMLname
-import fpconst
 
 # SOAPpy modules
 from Config import Config
@@ -330,11 +329,11 @@ class SOAPBuilder:
         if Config.strict_range:
             doubleType(obj)
 
-        if fpconst.isPosInf(obj):
+        if PosInf == obj:
             obj = "INF"
-        elif fpconst.isNegInf(obj):
+        elif NegInf == obj:
             obj = "-INF"
-        elif fpconst.isNaN(obj):
+        elif NaN == obj:
             obj = "NaN"
         else:
             obj = repr(obj)
diff --git a/src/SOAPpy/Types.py b/src/SOAPpy/Types.py
index 8cfee53..92838aa 100644
--- a/src/SOAPpy/Types.py
+++ b/src/SOAPpy/Types.py
@@ -53,6 +53,10 @@ from NS        import NS
 from Utilities import encodeHexString, cleanDate
 from Config    import Config
 
+NaN = float('NaN')
+PosInf = float('Inf')
+NegInf = -PosInf
+
 ###############################################################################
 # Utility functions
 ###############################################################################