Kirill Simonov avatar Kirill Simonov committed 0b7044e

Prepare setup.py for release. Fix #7.

Comments (0)

Files changed (7)

lib/yaml/representer.py

     def represent_long(self, data):
         return self.represent_scalar(u'tag:yaml.org,2002:int', unicode(data))
 
-    inf_value = 1e300000
-    nan_value = inf_value/inf_value
+    repr_pos_inf = repr(1e300000)
+    repr_neg_inf = repr(-1e30000)
+    repr_nan = repr(1e300000/1e300000)
 
     def represent_float(self, data):
-        if data == self.inf_value:
+        repr_data = repr(data)
+        if repr_data == self.repr_pos_inf:
             value = u'.inf'
-        elif data == -self.inf_value:
+        elif repr_data == self.repr_neg_inf:
             value = u'-.inf'
-        elif data == self.nan_value or data != data:
+        elif repr_data == self.repr_nan:
             value = u'.nan'
         else:
-            value = unicode(repr(data))
+            value = unicode(repr_data)
         return self.represent_scalar(u'tag:yaml.org,2002:float', value)
 
     def represent_list(self, data):
 
-NAME = 'PyYAML3000'
-VERSION = '0.1'
-DESCRIPTION = "The next generation YAML parser for Python"
+NAME = 'PyYAML'
+VERSION = '3.0'
+DESCRIPTION = "YAML parser and emitter for Python"
+LONG_DESCRIPTION = """\
+YAML is a data serialization format designed for human readability and
+interaction with scripting languages.  PyYAML is a YAML parser and emitter
+for Python.
+
+PyYAML features a complete YAML 1.1 parser, Unicode support, event-based parser
+and emitter (like SAX), API for serializing and deserializing Python objects
+(like DOM or pickle).  PyYAML supports all tags from the YAML types repository
+and allows you to extend it easily.
+
+PyYAML is applicable for a broad range of tasks from configuration files to
+object persistance."""
 AUTHOR = "Kirill Simonov"
 AUTHOR_EMAIL = 'xi@resolvent.net'
 LICENSE = "MIT"
+PLATFORMS = "Any"
+URL = "http://pyyaml.org/wiki/PyYAML"
+DOWNLOAD_URL = "http://pyyaml.org/download/pyyaml/%s-%s.tar.gz" % (NAME, VERSION)
+CLASSIFIERS = [
+    "Development Status :: 4 - Beta",
+    "Intended Audience :: Developers",
+    "License :: OSI Approved :: MIT License",
+    "Operating System :: OS Independent",
+    "Programming Language :: Python",
+    "Topic :: Software Development :: Libraries :: Python Modules",
+    "Topic :: Text Processing :: Markup",
+]
+
 
 from distutils.core import setup
 
     name=NAME,
     version=VERSION,
     description=DESCRIPTION,
+    long_description=LONG_DESCRIPTION,
     author=AUTHOR,
     author_email=AUTHOR_EMAIL,
     license=LICENSE,
+    platforms=PLATFORMS,
+    url=URL,
+    download_url=DOWNLOAD_URL,
+    classifiers=CLASSIFIERS,
 
     package_dir={'': 'lib'},
     packages=['yaml'],

tests/data/float-representer-2.3-bug.code

+{
+#    0.0: 0,
+    1.0: 1,
+    1e300000: +10,
+    -1e300000: -10,
+    1e300000/1e300000: 100,
+}

tests/data/float-representer-2.3-bug.data

+#0.0:   # hash(0) == hash(nan) and 0 == nan in Python 2.3
+1.0: 1
++.inf: 10
+-.inf: -10
+.nan: 100

tests/test_appliance.py

                 filenames = [os.path.join(cls.DATA, test+ext) for ext in extensions]
                 def test_method(self, test=test, filenames=filenames):
                     getattr(self, '_'+method_name)(test, *filenames)
-                test = test.replace('-', '_')
+                test = test.replace('-', '_').replace('.', '_')
                 try:
                     test_method.__name__ = '%s_%s' % (method_name, test)
                 except TypeError:

tests/test_constructor.py

                 self.failUnlessEqual(data1, data2)
             except AssertionError:
                 if isinstance(data1, dict):
-                    data1 = data1.items()
+                    data1 = [(repr(key), value) for key, value in data1.items()]
                     data1.sort()
                     data1 = repr(data1)
-                    data2 = data2.items()
+                    data2 = [(repr(key), value) for key, value in data2.items()]
                     data2.sort()
                     data2 = repr(data2)
                 if data1 != data2:

tests/test_representer.py

                 self.failUnlessEqual(data1, data2)
             except AssertionError:
                 if isinstance(data1, dict):
-                    data1 = data1.items()
+                    data1 = [(repr(key), value) for key, value in data1.items()]
                     data1.sort()
                     data1 = repr(data1)
-                    data2 = data2.items()
+                    data2 = [(repr(key), value) for key, value in data2.items()]
                     data2.sort()
                     data2 = repr(data2)
                     if data1 != data2:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.