Commits

AJ R committed a5c9381

Finishing touches for version 3.3.0; mainly setup.py and related

Comments (0)

Files changed (9)

 graft savReaderWriter/documentation
 graft savReaderWriter/doc_tests
 graft savReaderWriter/test_data
-#graft savReaderWriter/spssio
-prune savReaderWriter/spssio
-graft savReaderWriter/spssio/lin32
+graft savReaderWriter/spssio
+#prune savReaderWriter/spssio
+#graft savReaderWriter/spssio/lin32
 include ez_setup.py
+include sha1version.py
+include savReaderWriter/SHA1VERSION
 include VERSION
 include TODO
 include COPYRIGHT
-3.2.1
+3.3.0

savReaderWriter/README

-SavReaderWriter
-===============
-
-A cross-platform Python interface to the IBM SPSS 
-Statistics Input Output Module. Read or Write SPSS
-system files (.sav, .zsav)
-
-installation::
-
-    python setup.py install
-
-Or alternatively::
-
-    pip install savReaderWriter --allow-all-external
-
-To get the 'bleeding edge' version straight from the repository do::
-
-    pip install -U -e git+https://bitbucket.org/fomcl/savreaderwriter.git#egg=savreaderwriter

savReaderWriter/TODO

-Fix spssSetDateVariables wrapper to set SPSS Trends info

savReaderWriter/VERSION

-3.2.1

savReaderWriter/documentation/index.rst

     pip install -U -e git+https://bitbucket.org/fomcl/savreaderwriter.git#egg=savreaderwriter
 
 .. versionchanged:: 3.3
-* The ``savReaderWriter`` program now runs on Python 2 and 3. It is tested with Python 2.7 and 3.3.
-It also appears to work with PyPy.
-* ``savReaderWriter`` now uses version 22.0.0.0 of the I/O modules.
+* The ``savReaderWriter`` program now runs on Python 2 and 3. It is tested with Python 2.7, 3.3 and PyPy
 * Several bugs were removed, notably two that prevented the I/O modules from loading in 64-bit Linux and 64-bit Windows systems (NB: these bugs were entirely unrelated). In addition, long variable labels were truncated to 120 characters, which is now fixed.
 
 .. versionchanged:: 3.2
 
 :mod:`SavReader` -- Read SPSS system files
 ============================================================================
-.. function:: SavReader(savFileName, [returnHeader=False, recodeSysmisTo=None,                 verbose=False, selectVars=None, idVar=None, rawMode=False, ioUtf8=False, ioLocale=None])
+.. function:: SavReader(savFileName, [returnHeader=False, recodeSysmisTo=None, verbose=False, selectVars=None, idVar=None, rawMode=False, ioUtf8=False, ioLocale=None])
 
    **Read SPSS system files (.sav, .zsav)**
 
 # sudo python setup.py check upload_sphinx --upload-dir=build/sphinx/html
 
 import os
-import shutil
 import sys
 import platform
 
-sys.path.append(os.path.dirname(os.path.realpath(__file__)))
+path = os.path.dirname(os.path.realpath(__file__)) or os.getcwd()
+sys.path.insert(0, path)
+
 try:
     from ez_setup import use_setuptools
     use_setuptools()
     pass # Tox
 from setuptools import setup
 
+
 def read(fname):
     return open(os.path.join(os.path.dirname(__file__), fname)).read().strip()
 
 
 ## *building* the package: include all the libraries
 else: 
-    package_data['savReaderWriter'].extend(['spssio/win64/*.*',
-                                            'spssio/macos/*.*',
-                                            'spssio/win32/*.*',
-                                            'spssio/sol64/*.*',
+    package_data['savReaderWriter'].extend(['spssio/win32/*.*',
+                                            'spssio/win64/*.*',
                                             'spssio/lin32/*.*',
+                                            'spssio/zlinux64/*.*',
                                             'spssio/lin64/*.*',
+                                            'spssio/macos/*.*',
+                                            'spssio/aix64/*.*'
                                             'spssio/hpux_it/*.*',
-                                            'spssio/zlinux64/*.*',
-                                            'spssio/aix64/*.*'])
+                                            'spssio/sol64/*.*'])
 
 email = "@".join(["fomcl", "yahoo.com"])
 
 #     src = os.path.join(p, f)
 #     dst = os.path.join(p, "savReaderWriter", f)
 #     shutil.copy(src, dst)
+
+with open(os.path.join(path, "savReaderWriter", "SHA1VERSION"), "wb") as f:
+    try:
+        import sha1version
+        f.write(sha1version.getHEADhash())
+    except:
+        f.write(b"--UNKNOWN--")
 
 import os
 import subprocess
+import sys
 
 path = os.path.dirname(os.path.realpath("__file__"))
 
 def callShell(cmd, cwd=path):
-    subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
     proc = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, shell=True)
     stdout, stderr = proc.communicate()
     if not stderr:
-        return stdout.split("\n")
+        stdout = stdout.split(b"\n")
+        try:
+            return [item.decode("utf-8") for item in stdout]
+        except:
+            return stdout
     return []
 
-def getHEADhash(strict=False):
+def getHEADhash(strict=False, cwd=path):
     """Returns a label for the HEAD revision of a Git repository. The label has
     the form <tag>-<SHA1 hash>-dirty. The '-dirty' suffix is only present if
     there are uncommitted changes. If strict, raise ValueError in case of
     untagged and/or dirty files. Example output:
     v1.0.1-fb74f0a6caf0385918b6971c6248977e97662a93-dirty"""
-    tags = callShell("git tag -l")
-    taglookup = {callShell("git rev-parse %s" % tag)[0]: tag for tag in tags}
-    head_hash = callShell("git rev-parse HEAD")[0]
+    tags = callShell("git tag -l", cwd)
+    taglookup = {callShell("git rev-parse %s" % tag, cwd)[0]: tag for \
+                 tag in tags}
+    head_hash = callShell("git rev-parse HEAD", cwd)[0]
     isDirty = bool(callShell("git status -s")[0])
     isTagged = bool(taglookup.get(head_hash))
     if isTagged:
     if strict:
         if isDirty or not isTagged or label == "UNKNOWN":
             raise ValueError("Problem determining version: %r" % label)
+    if sys.version_info[0] > 2:
+        return bytes(label, "utf-8")
     return label
 
-with open(os.path.join(path, "savReaderWriter", "SHA1VERSION"), "wb") as f:
-    f.write(getHEADhash())
+if __name__ == "__main__":
+    with open(os.path.join(path, "SHA1VERSION"), "wb") as f:
+        f.write(getHEADhash())
 #,docs
 [tox]
 envlist = py27,py33,pypy
-skipsdist = True
+skipsdist = False
 
 [testenv]
 deps =