From f58ec8ecb7ca7358af58084d5fc0764767718b41 Mon Sep 17 00:00:00 2001
From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com>
Date: Tue, 26 Nov 2013 20:00:55 -0800
Subject: [PATCH] tidying and a README about this part of the build

---
 src/bindings/python/README.md | 1 +
 src/bindings/python/setup.py  | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
 create mode 100644 src/bindings/python/README.md

diff --git a/src/bindings/python/README.md b/src/bindings/python/README.md
new file mode 100644
index 00000000..bdbf95e2
--- /dev/null
+++ b/src/bindings/python/README.md
@@ -0,0 +1 @@
+The distutils script in this directory is meant to be invoked from scons. It will work if you build it here (`python setup.py build_ext`, optionally `--inplace` as scons invokes it), but we haven't done much testing of it outside the build system and don't really intend to. YHBW.
\ No newline at end of file
diff --git a/src/bindings/python/setup.py b/src/bindings/python/setup.py
index 720590e6..308283c8 100644
--- a/src/bindings/python/setup.py
+++ b/src/bindings/python/setup.py
@@ -7,7 +7,8 @@ import os, os.path, sys
 from distutils.core import setup, Extension
 
 invoked = os.getcwd()
-os.chdir(os.path.dirname(sys.argv[0]))
+if (os.path.dirname(sys.argv[0]) != ''):
+    os.chdir(os.path.dirname(sys.argv[0]))
 
 setup(name="hammer",
       version="0.9.0",
@@ -17,7 +18,6 @@ setup(name="hammer",
       description="""The Hammer parser combinator library""",
       ext_modules=[Extension('_hammer', ['hammer.i'],
                              swig_opts=['-DHAMMER_INTERNAL__NO_STDARG_H',
-                                        #('-outdir', os.getcwd()),
                                         '-I../../'],
                              define_macros=[('SWIG', None)],
                              depends=['allocator.h', 
-- 
GitLab