0

Fix up python3 detection

This commit is contained in:
Andrew Chin
2014-01-06 08:47:03 -05:00
parent 519e13a34f
commit a2780197cb
2 changed files with 18 additions and 9 deletions

View File

@@ -151,7 +151,7 @@ def main():
if util.pid_exists(pid): if util.pid_exists(pid):
print("Already running (pid exists) - exiting..") print("Already running (pid exists) - exiting..")
return 0 return 0
except IOError, ValueError: except (IOError, ValueError):
pass pass
with open(options.pid,"w") as f: with open(options.pid,"w") as f:
f.write(str(os.getpid())) f.write(str(os.getpid()))

View File

@@ -1,5 +1,14 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys
# quick version check
if not (sys.version_info[0] == 2 and sys.version_info[1] >= 6):
print("Sorry, the Overviewer requires at least Python 2.6 to run")
if sys.version_info[0] >= 3:
print("and will not run on Python 3.0 or later")
sys.exit(1)
from distutils.core import setup from distutils.core import setup
from distutils.extension import Extension from distutils.extension import Extension
from distutils.command.build import build from distutils.command.build import build
@@ -10,7 +19,7 @@ from distutils.cmd import Command
from distutils.dir_util import remove_tree from distutils.dir_util import remove_tree
from distutils.sysconfig import get_python_inc from distutils.sysconfig import get_python_inc
from distutils import log from distutils import log
import sys, os, os.path import os, os.path
import glob import glob
import platform import platform
import time import time
@@ -229,7 +238,7 @@ def generate_version_py():
f.write(outstr) f.write(outstr)
f.close() f.close()
except Exception: except Exception:
print "WARNING: failed to build overviewer_version file" print("WARNING: failed to build overviewer_version file")
def generate_primitives_h(): def generate_primitives_h():
global primitives global primitives
@@ -261,13 +270,13 @@ class CustomBuild(build):
generate_version_py() generate_version_py()
generate_primitives_h() generate_primitives_h()
build.run(self) build.run(self)
print "\nBuild Complete" print("\nBuild Complete")
except Exception: except Exception:
print "\nFailed to build Overviewer!" print("\nFailed to build Overviewer!")
print "Please review the errors printed above and the build instructions" print("Please review the errors printed above and the build instructions")
print "at <http://docs.overviewer.org/en/latest/building/>. If you are" print("at <http://docs.overviewer.org/en/latest/building/>. If you are")
print "still having build problems, file an incident on the github tracker" print("still having build problems, file an incident on the github tracker")
print "or find us in IRC." print("or find us in IRC.")
class CustomBuildExt(build_ext): class CustomBuildExt(build_ext):
def build_extensions(self): def build_extensions(self):