Remove the last remnants of local pybindgen handling (allinone takes care of pybindgen now)
This commit is contained in:
@@ -14,11 +14,6 @@ import Logs
|
||||
import Build
|
||||
import Utils
|
||||
|
||||
## Adjust python path to look for our local copy of pybindgen
|
||||
LOCAL_PYBINDGEN_PATH = os.path.join(os.getcwd(), "bindings", "python", "pybindgen")
|
||||
#PYBINDGEN_BRANCH = 'lp:pybindgen'
|
||||
PYBINDGEN_BRANCH = 'https://launchpad.net/pybindgen'
|
||||
|
||||
## https://launchpad.net/pybindgen/
|
||||
REQUIRED_PYBINDGEN_VERSION = (0, 9, 0, 605)
|
||||
REQUIRED_PYGCCXML_VERSION = (0, 9, 5)
|
||||
@@ -33,8 +28,6 @@ def add_to_python_path(path):
|
||||
def set_pybindgen_pythonpath(env):
|
||||
if env['WITH_PYBINDGEN']:
|
||||
add_to_python_path(env['WITH_PYBINDGEN'])
|
||||
else:
|
||||
add_to_python_path(LOCAL_PYBINDGEN_PATH)
|
||||
|
||||
|
||||
def set_options(opt):
|
||||
@@ -47,67 +40,11 @@ def set_options(opt):
|
||||
help=("Rescan Python bindings. Needs working GCCXML / pygccxml environment."),
|
||||
action="store_true", default=False,
|
||||
dest='python_scan')
|
||||
opt.add_option('--pybindgen-checkout',
|
||||
help=("During configure, force checkout of pybingen inside ns-3, "
|
||||
"instead of using the system installed version."),
|
||||
action="store_true", default=False,
|
||||
dest='pybindgen_checkout')
|
||||
opt.add_option('--with-pybindgen',
|
||||
help=('Path to an existing pybindgen source tree to use.'),
|
||||
default=None,
|
||||
dest='with_pybindgen', type="string")
|
||||
|
||||
def fetch_pybindgen(conf):
|
||||
"""
|
||||
Fetches pybindgen from launchpad as bindings/python/pybindgen.
|
||||
Returns True if successful, False it not.
|
||||
"""
|
||||
bzr = conf.find_program("bzr")
|
||||
if not bzr:
|
||||
Logs.warn("the program 'bzr' is needed in order to fetch pybindgen")
|
||||
return False
|
||||
if len(REQUIRED_PYBINDGEN_VERSION) == 4:
|
||||
rev = "-rrevno:%i" % REQUIRED_PYBINDGEN_VERSION[3]
|
||||
else:
|
||||
rev = "-rtag:%s" % '.'.join([str(x) for x in REQUIRED_PYBINDGEN_VERSION])
|
||||
|
||||
if os.path.exists(LOCAL_PYBINDGEN_PATH):
|
||||
print "Trying to update pybindgen; this will fail if no network connection is available. Hit Ctrl-C to skip."
|
||||
|
||||
cmd = [bzr, "pull", rev, PYBINDGEN_BRANCH]
|
||||
print " => ", ' '.join(cmd)
|
||||
try:
|
||||
if subprocess.Popen(cmd, cwd=LOCAL_PYBINDGEN_PATH).wait():
|
||||
return False
|
||||
except KeyboardInterrupt:
|
||||
print "Interrupted; Python bindings will be disabled."
|
||||
return False
|
||||
print "Update was successful."
|
||||
else:
|
||||
print "Trying to fetch pybindgen; this will fail if no network connection is available. Hit Ctrl-C to skip."
|
||||
cmd = [bzr, "checkout", rev, PYBINDGEN_BRANCH, LOCAL_PYBINDGEN_PATH]
|
||||
print " => ", ' '.join(cmd)
|
||||
try:
|
||||
if subprocess.Popen(cmd).wait():
|
||||
return False
|
||||
except KeyboardInterrupt:
|
||||
print "Interrupted; Python bindings will be disabled."
|
||||
shutil.rmtree(LOCAL_PYBINDGEN_PATH, True)
|
||||
return False
|
||||
print "Fetch was successful."
|
||||
|
||||
## generate a fake version.py file in pybindgen it's safer this
|
||||
## way, since the normal version generation process requires
|
||||
## bazaar python bindings, which may not be available.
|
||||
vfile = open(os.path.join(LOCAL_PYBINDGEN_PATH, "pybindgen", "version.py"), "wt")
|
||||
vfile.write("""
|
||||
# (fake version generated by ns-3)
|
||||
__version__ = %r
|
||||
""" % list(REQUIRED_PYBINDGEN_VERSION))
|
||||
vfile.close()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def configure(conf):
|
||||
conf.env['ENABLE_PYTHON_BINDINGS'] = False
|
||||
@@ -140,9 +77,6 @@ def configure(conf):
|
||||
conf.env['WITH_PYBINDGEN'] = os.path.abspath(Options.options.with_pybindgen)
|
||||
no_net = True
|
||||
|
||||
if Options.options.pybindgen_checkout:
|
||||
fetch_pybindgen(conf)
|
||||
|
||||
set_pybindgen_pythonpath(conf.env)
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user