summaryrefslogtreecommitdiff
path: root/scripts/Util.py
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2016-12-23 18:58:35 +0100
committerBenoit Foucher <benoit@zeroc.com>2016-12-23 18:58:35 +0100
commitcf52f640e734d71425f57b89a7cb24e49e71f7f0 (patch)
treef72f5db8ade316238e2d4624ba96449ca6081213 /scripts/Util.py
parentFix Windows PHP builds to remove unused dependencies (diff)
downloadice-cf52f640e734d71425f57b89a7cb24e49e71f7f0.tar.bz2
ice-cf52f640e734d71425f57b89a7cb24e49e71f7f0.tar.xz
ice-cf52f640e734d71425f57b89a7cb24e49e71f7f0.zip
Added support for using the local IcePy for remote communications
Diffstat (limited to 'scripts/Util.py')
-rw-r--r--scripts/Util.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/scripts/Util.py b/scripts/Util.py
index 0684b3b0cbd..4503cfbf739 100644
--- a/scripts/Util.py
+++ b/scripts/Util.py
@@ -2278,6 +2278,15 @@ class Driver:
if self.communicator:
return
+ try:
+ import Ice
+ except ImportError:
+ # Try to add the local Python build to the sys.path
+ pythonMapping = Mapping.getByName("python")
+ if pythonMapping:
+ for p in pythonMapping.getPythonDirs(pythonMapping.getPath(), self.configs[pythonMapping]):
+ sys.path.append(p)
+
import Ice
Ice.loadSlice(os.path.join(toplevel, "scripts", "Controller.ice"))
@@ -2627,20 +2636,21 @@ class PythonMapping(CppBasedMapping):
return sys.executable + " " + exe
def getEnv(self, process, current):
- c = current.config
env = CppBasedMapping.getEnv(self, process, current)
if current.driver.getIceDir(self, current) != platform.getIceDir(self, current):
# If not installed in the default platform installation directory, add
# the Ice python directory to PYTHONPATH
-
- pythondirs = []
- if isinstance(platform, Windows):
- pythondirs.append(os.path.join(current.driver.getIceDir(self, current), "python", c.buildPlatform, c.buildConfig))
- pythondirs.append(os.path.join(current.driver.getIceDir(self, current), "python"))
-
- env["PYTHONPATH"] = os.pathsep.join(pythondirs)
+ dirs = self.getPythonDirs(current.driver.getIceDir(self, current), current.config)
+ env["PYTHONPATH"] = os.pathsep.join(dirs)
return env
+ def getPythonDirs(self, iceDir, config):
+ dirs = []
+ if isinstance(platform, Windows):
+ dirs.append(os.path.join(iceDir, "python", config.buildPlatform, config.buildConfig))
+ dirs.append(os.path.join(iceDir, "python"))
+ return dirs
+
def getDefaultExe(self, processType, config):
return self.getDefaultSource(processType)
@@ -2894,10 +2904,11 @@ def runTests(mappings=None, drivers=None):
driver = Driver.create(opts)
#
- # Create the configurations for each mapping
+ # Create the configurations for each mapping (we always parse the configuration for the
+ # python mapping because we might use the local IcePy build to initialize a communicator).
#
configs = {}
- for mapping in allMappings + driver.getMappings():
+ for mapping in allMappings + driver.getMappings() + [Mapping.getByName("python")]:
if mapping not in configs:
configs[mapping] = mapping.createConfig(opts[:])