summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2012-04-04 09:22:36 -0500
committerSol Jerome <sol.jerome@gmail.com>2012-04-04 09:22:36 -0500
commit477a4028eb8ba34e0a453125fd39120d23bdeb6e (patch)
treeb4056c573eb78461575b01397c22c5e532714439
parentea5edd121a999cf3068ee41fd5fa4a7d0e3a1636 (diff)
downloadbcfg2-477a4028eb8ba34e0a453125fd39120d23bdeb6e.tar.gz
bcfg2-477a4028eb8ba34e0a453125fd39120d23bdeb6e.tar.bz2
bcfg2-477a4028eb8ba34e0a453125fd39120d23bdeb6e.zip
Remove fprint in favor of cleaner setup.py
We only used the new fancy file printing function in one place, but it caused massive ugliness in setup.py. Easier to use file.write() for now. Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
-rwxr-xr-xsetup.py4
-rw-r--r--src/lib/Bcfg2/Bcfg2Py3Incompat.py2
-rw-r--r--src/lib/Bcfg2/Bcfg2Py3k.py11
-rw-r--r--src/lib/Bcfg2/Component.py4
4 files changed, 2 insertions, 19 deletions
diff --git a/setup.py b/setup.py
index f819ecd22..a16e3578b 100755
--- a/setup.py
+++ b/setup.py
@@ -121,10 +121,6 @@ try:
except ImportError:
pass
-py3lib = 'src/lib/Bcfg2/Bcfg2Py3Incompat.py'
-if sys.hexversion < 0x03000000 and os.path.exists(py3lib):
- os.remove(py3lib)
-
inst_reqs = ["lxml"]
if need_m2crypto:
inst_reqs.append("M2Crypto")
diff --git a/src/lib/Bcfg2/Bcfg2Py3Incompat.py b/src/lib/Bcfg2/Bcfg2Py3Incompat.py
deleted file mode 100644
index 6b66e72b0..000000000
--- a/src/lib/Bcfg2/Bcfg2Py3Incompat.py
+++ /dev/null
@@ -1,2 +0,0 @@
-def fprint(s, f):
- print(s, file=f)
diff --git a/src/lib/Bcfg2/Bcfg2Py3k.py b/src/lib/Bcfg2/Bcfg2Py3k.py
index ee05b7e41..6af8b3e5c 100644
--- a/src/lib/Bcfg2/Bcfg2Py3k.py
+++ b/src/lib/Bcfg2/Bcfg2Py3k.py
@@ -75,17 +75,6 @@ def u_str(string, encoding=None):
else:
return unicode(string)
-"""
-In order to use the new syntax for printing to a file, we need to do
-a conditional import because there is a syntax incompatibility between
-the two versions of python.
-"""
-if sys.hexversion >= 0x03000000:
- from Bcfg2.Bcfg2Py3Incompat import fprint
-else:
- def fprint(s, f):
- print >> f, s
-
if sys.hexversion >= 0x03000000:
from io import FileIO as file
else:
diff --git a/src/lib/Bcfg2/Component.py b/src/lib/Bcfg2/Component.py
index e21b5d359..eb9ea166a 100644
--- a/src/lib/Bcfg2/Component.py
+++ b/src/lib/Bcfg2/Component.py
@@ -14,7 +14,7 @@ import Bcfg2.Logger
from Bcfg2.Statistics import Statistics
from Bcfg2.SSLServer import XMLRPCServer
# Compatibility import
-from Bcfg2.Bcfg2Py3k import xmlrpclib, urlparse, fprint
+from Bcfg2.Bcfg2Py3k import xmlrpclib, urlparse
logger = logging.getLogger()
@@ -55,7 +55,7 @@ def run_component(component_cls, listen_all, location, daemon, pidfile_name,
os.chdir(os.sep)
pidfile = open(pidfile_name or "/dev/null", "w")
- fprint(os.getpid(), pidfile)
+ pidfile.write("%s\n" % os.getpid())
pidfile.close()
component = component_cls(cfile=cfile, **cls_kwargs)