diff options
68 files changed, 125 insertions, 718 deletions
@@ -32,6 +32,18 @@ C++ Changes - Fixed a bug which could cause the first invocation on a proxy to incorrectly be sent compressed or not compressed. +Python Changes +============== + +- Ice.getSliceDir() now only searches for the slice directory in + a standard Ice installation. + +Ruby Changes +============ + +- Added helper Ice.getSliceDir, which locates the slice directory + in a standard Ice installation. + ====================================================================== Changes since version 3.2.1 diff --git a/py/demo/Ice/bidir/Client.py b/py/demo/Ice/bidir/Client.py index 258d18447ba..916431c60ad 100755 --- a/py/demo/Ice/bidir/Client.py +++ b/py/demo/Ice/bidir/Client.py @@ -12,7 +12,7 @@ import os, sys, Ice slice_dir = Ice.getSliceDir() if not slice_dir: - print sys.argv[0] + ': Slice directory not found. Define ICE_HOME.' + print sys.argv[0] + ': Slice directory not found.' sys.exit(1) Ice.loadSlice('-I' + slice_dir + ' Callback.ice') diff --git a/py/demo/Ice/bidir/Server.py b/py/demo/Ice/bidir/Server.py index 9b5c3db5ffe..4d030437966 100755 --- a/py/demo/Ice/bidir/Server.py +++ b/py/demo/Ice/bidir/Server.py @@ -12,7 +12,7 @@ import os, sys, traceback, threading, Ice slice_dir = Ice.getSliceDir() if not slice_dir: - print sys.argv[0] + ': Slice directory not found. Define ICE_HOME.' + print sys.argv[0] + ': Slice directory not found.' sys.exit(1) Ice.loadSlice('-I' + slice_dir + ' Callback.ice') diff --git a/py/python/Ice.py b/py/python/Ice.py index 2e8caa6267c..1682b85b302 100644 --- a/py/python/Ice.py +++ b/py/python/Ice.py @@ -103,14 +103,6 @@ class UserException(Exception): # def getSliceDir(): # - # Check for <ICE_HOME>/slice first. - # - if os.environ.has_key("ICE_HOME"): - dir = os.path.join(os.environ["ICE_HOME"], "slice") - if os.path.exists(dir): - return dir - - # # Get the parent of the directory containing this file (Ice.py). # pyHome = os.path.join(os.path.dirname(__file__), "..") @@ -133,28 +125,11 @@ def getSliceDir(): iceVer = stringVersion() - # - # Check platform-specific locations. - # - if sys.platform[:6] == "cygwin" or sys.platform == "win32": - dir = os.path.join("\\", "Ice-" + iceVer, "slice") - if os.path.exists(dir): - return dir - dir = os.path.join("C:\\", "Ice-" + iceVer, "slice") - if os.path.exists(dir): - return dir - else: - if sys.platform[:5] == "linux": - # - # Check the default RPM location. - # - dir = os.path.join("/", "usr", "share", "Ice-" + iceVer, "slice") - if os.path.exists(dir): - return dir + if sys.platform[:5] == "linux": # - # Check in /opt. + # Check the default RPM location. # - dir = os.path.join("/", "opt", "Ice-" + iceVer, "slice") + dir = os.path.join("/", "usr", "share", "Ice-" + iceVer, "slice") if os.path.exists(dir): return dir diff --git a/py/test/Ice/adapterDeactivation/Client.py b/py/test/Ice/adapterDeactivation/Client.py index 30027f180b2..1abcd543953 100755 --- a/py/test/Ice/adapterDeactivation/Client.py +++ b/py/test/Ice/adapterDeactivation/Client.py @@ -10,13 +10,6 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, AllTests diff --git a/py/test/Ice/adapterDeactivation/Collocated.py b/py/test/Ice/adapterDeactivation/Collocated.py index d9d33612bff..fa8e650c8c2 100755 --- a/py/test/Ice/adapterDeactivation/Collocated.py +++ b/py/test/Ice/adapterDeactivation/Collocated.py @@ -10,13 +10,6 @@ import os, sys, traceback, time -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, TestI, AllTests diff --git a/py/test/Ice/adapterDeactivation/Server.py b/py/test/Ice/adapterDeactivation/Server.py index fba85833131..563c4bfd2eb 100755 --- a/py/test/Ice/adapterDeactivation/Server.py +++ b/py/test/Ice/adapterDeactivation/Server.py @@ -9,13 +9,6 @@ import os, sys, traceback, time -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, TestI diff --git a/py/test/Ice/binding/Client.py b/py/test/Ice/binding/Client.py index ceb94b83a78..3ddbb1cf5d1 100755 --- a/py/test/Ice/binding/Client.py +++ b/py/test/Ice/binding/Client.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') diff --git a/py/test/Ice/binding/Server.py b/py/test/Ice/binding/Server.py index 39b5e5d211c..412d5c18eb8 100755 --- a/py/test/Ice/binding/Server.py +++ b/py/test/Ice/binding/Server.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, TestI diff --git a/py/test/Ice/blobject/Client.py b/py/test/Ice/blobject/Client.py index b402d0e8145..33fd79c3f94 100755 --- a/py/test/Ice/blobject/Client.py +++ b/py/test/Ice/blobject/Client.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test diff --git a/py/test/Ice/blobject/Server.py b/py/test/Ice/blobject/Server.py index af986ad5dd3..2db1fb2ea7b 100755 --- a/py/test/Ice/blobject/Server.py +++ b/py/test/Ice/blobject/Server.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') diff --git a/py/test/Ice/checksum/Client.py b/py/test/Ice/checksum/Client.py index 446b41fe545..11b4d7f38cb 100755 --- a/py/test/Ice/checksum/Client.py +++ b/py/test/Ice/checksum/Client.py @@ -10,20 +10,9 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) diff --git a/py/test/Ice/checksum/Server.py b/py/test/Ice/checksum/Server.py index c2f72db5dfd..36f1f490d45 100755 --- a/py/test/Ice/checksum/Server.py +++ b/py/test/Ice/checksum/Server.py @@ -10,20 +10,9 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) diff --git a/py/test/Ice/custom/Client.py b/py/test/Ice/custom/Client.py index b2b2e281a4f..34f5c7f822c 100755 --- a/py/test/Ice/custom/Client.py +++ b/py/test/Ice/custom/Client.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, AllTests diff --git a/py/test/Ice/custom/Server.py b/py/test/Ice/custom/Server.py index 8a2f638971e..7c74dcf52a6 100755 --- a/py/test/Ice/custom/Server.py +++ b/py/test/Ice/custom/Server.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test diff --git a/py/test/Ice/exceptions/Client.py b/py/test/Ice/exceptions/Client.py index af419d19e1d..775d7a06658 100755 --- a/py/test/Ice/exceptions/Client.py +++ b/py/test/Ice/exceptions/Client.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import AllTests diff --git a/py/test/Ice/exceptions/Collocated.py b/py/test/Ice/exceptions/Collocated.py index 50aab50055f..773e9e57927 100755 --- a/py/test/Ice/exceptions/Collocated.py +++ b/py/test/Ice/exceptions/Collocated.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, TestI, AllTests diff --git a/py/test/Ice/exceptions/Server.py b/py/test/Ice/exceptions/Server.py index f89adc3b362..32892b87638 100755 --- a/py/test/Ice/exceptions/Server.py +++ b/py/test/Ice/exceptions/Server.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, TestI diff --git a/py/test/Ice/exceptions/ServerAMD.py b/py/test/Ice/exceptions/ServerAMD.py index 38580006f7a..ef7d3f42bef 100755 --- a/py/test/Ice/exceptions/ServerAMD.py +++ b/py/test/Ice/exceptions/ServerAMD.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('TestAMD.ice') import Test diff --git a/py/test/Ice/facets/Client.py b/py/test/Ice/facets/Client.py index 91623582c73..5245c80d072 100755 --- a/py/test/Ice/facets/Client.py +++ b/py/test/Ice/facets/Client.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') diff --git a/py/test/Ice/facets/Collocated.py b/py/test/Ice/facets/Collocated.py index ca9e6dc665c..d91bf2acebc 100755 --- a/py/test/Ice/facets/Collocated.py +++ b/py/test/Ice/facets/Collocated.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, TestI, AllTests diff --git a/py/test/Ice/facets/Server.py b/py/test/Ice/facets/Server.py index dbe3b98c7f5..2d7c49b7c2c 100755 --- a/py/test/Ice/facets/Server.py +++ b/py/test/Ice/facets/Server.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, TestI diff --git a/py/test/Ice/faultTolerance/Client.py b/py/test/Ice/faultTolerance/Client.py index a0640c58c20..1e71c934eea 100755 --- a/py/test/Ice/faultTolerance/Client.py +++ b/py/test/Ice/faultTolerance/Client.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice, AllTests def test(b): diff --git a/py/test/Ice/faultTolerance/Server.py b/py/test/Ice/faultTolerance/Server.py index e753c4fbb6a..5d6b01c5ae0 100755 --- a/py/test/Ice/faultTolerance/Server.py +++ b/py/test/Ice/faultTolerance/Server.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test diff --git a/py/test/Ice/inheritance/Client.py b/py/test/Ice/inheritance/Client.py index 1c68ab740a9..2ea77ac8141 100755 --- a/py/test/Ice/inheritance/Client.py +++ b/py/test/Ice/inheritance/Client.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import AllTests diff --git a/py/test/Ice/inheritance/Collocated.py b/py/test/Ice/inheritance/Collocated.py index 202292cf7bc..647807b8fb5 100755 --- a/py/test/Ice/inheritance/Collocated.py +++ b/py/test/Ice/inheritance/Collocated.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, TestI, AllTests diff --git a/py/test/Ice/inheritance/Server.py b/py/test/Ice/inheritance/Server.py index 0ea27904b8c..b02542b73b5 100755 --- a/py/test/Ice/inheritance/Server.py +++ b/py/test/Ice/inheritance/Server.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, TestI diff --git a/py/test/Ice/location/Client.py b/py/test/Ice/location/Client.py index 6c673ae57c5..ae305aa3c48 100755 --- a/py/test/Ice/location/Client.py +++ b/py/test/Ice/location/Client.py @@ -10,20 +10,9 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) diff --git a/py/test/Ice/location/Server.py b/py/test/Ice/location/Server.py index 4f7c5870c5b..7b76f74d9f0 100755 --- a/py/test/Ice/location/Server.py +++ b/py/test/Ice/location/Server.py @@ -10,20 +10,9 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) diff --git a/py/test/Ice/objects/Client.py b/py/test/Ice/objects/Client.py index 073a47e6c54..f5fb5b7b5e9 100755 --- a/py/test/Ice/objects/Client.py +++ b/py/test/Ice/objects/Client.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') Ice.loadSlice('ClientPrivate.ice') diff --git a/py/test/Ice/objects/Collocated.py b/py/test/Ice/objects/Collocated.py index 9db84e6d90c..7067f40b2db 100755 --- a/py/test/Ice/objects/Collocated.py +++ b/py/test/Ice/objects/Collocated.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') Ice.loadSlice('ClientPrivate.ice') diff --git a/py/test/Ice/objects/Server.py b/py/test/Ice/objects/Server.py index 7aee9423d4a..4f7577f9e5f 100755 --- a/py/test/Ice/objects/Server.py +++ b/py/test/Ice/objects/Server.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') Ice.loadSlice('ServerPrivate.ice') diff --git a/py/test/Ice/operations/Client.py b/py/test/Ice/operations/Client.py index 9a0c6494b99..e4a3fd608f4 100755 --- a/py/test/Ice/operations/Client.py +++ b/py/test/Ice/operations/Client.py @@ -10,22 +10,12 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +import Ice +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -import Ice Ice.loadSlice('-I' + slice_dir + ' Test.ice') import AllTests diff --git a/py/test/Ice/operations/Collocated.py b/py/test/Ice/operations/Collocated.py index cdd3503654e..92df3f66ed5 100755 --- a/py/test/Ice/operations/Collocated.py +++ b/py/test/Ice/operations/Collocated.py @@ -10,22 +10,12 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +import Ice +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -import Ice Ice.loadSlice('-I' + slice_dir + ' Test.ice') import Test, TestI, AllTests diff --git a/py/test/Ice/operations/Server.py b/py/test/Ice/operations/Server.py index f23901880c4..a29df353b22 100755 --- a/py/test/Ice/operations/Server.py +++ b/py/test/Ice/operations/Server.py @@ -9,21 +9,9 @@ # ********************************************************************** import os, sys, traceback - -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) diff --git a/py/test/Ice/operations/ServerAMD.py b/py/test/Ice/operations/ServerAMD.py index 5a1cf52631b..b1510246cc3 100755 --- a/py/test/Ice/operations/ServerAMD.py +++ b/py/test/Ice/operations/ServerAMD.py @@ -10,20 +10,9 @@ import os, sys, traceback, threading -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) diff --git a/py/test/Ice/proxy/Client.py b/py/test/Ice/proxy/Client.py index 070df3ac032..d3493a01eca 100755 --- a/py/test/Ice/proxy/Client.py +++ b/py/test/Ice/proxy/Client.py @@ -10,22 +10,12 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +import Ice +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -import Ice Ice.loadSlice('-I' + slice_dir + ' Test.ice') import AllTests diff --git a/py/test/Ice/proxy/Collocated.py b/py/test/Ice/proxy/Collocated.py index cdd3503654e..92df3f66ed5 100755 --- a/py/test/Ice/proxy/Collocated.py +++ b/py/test/Ice/proxy/Collocated.py @@ -10,22 +10,12 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +import Ice +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -import Ice Ice.loadSlice('-I' + slice_dir + ' Test.ice') import Test, TestI, AllTests diff --git a/py/test/Ice/proxy/Server.py b/py/test/Ice/proxy/Server.py index 67d8a99ebc1..d953a8cd44e 100755 --- a/py/test/Ice/proxy/Server.py +++ b/py/test/Ice/proxy/Server.py @@ -10,20 +10,9 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) diff --git a/py/test/Ice/proxy/ServerAMD.py b/py/test/Ice/proxy/ServerAMD.py index 0f7bc95d964..8247a527a06 100755 --- a/py/test/Ice/proxy/ServerAMD.py +++ b/py/test/Ice/proxy/ServerAMD.py @@ -10,20 +10,9 @@ import os, sys, traceback, time -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) diff --git a/py/test/Ice/retry/Client.py b/py/test/Ice/retry/Client.py index c951e0e95e1..d55ec75dbe7 100755 --- a/py/test/Ice/retry/Client.py +++ b/py/test/Ice/retry/Client.py @@ -10,22 +10,12 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +import Ice +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -import Ice Ice.loadSlice('-I' + slice_dir + ' Test.ice') import AllTests diff --git a/py/test/Ice/retry/Server.py b/py/test/Ice/retry/Server.py index 421936558a6..4ad4a4a03c1 100755 --- a/py/test/Ice/retry/Server.py +++ b/py/test/Ice/retry/Server.py @@ -10,20 +10,9 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) diff --git a/py/test/Ice/servantLocator/Client.py b/py/test/Ice/servantLocator/Client.py index d89bcd2360f..cf17c8437bd 100755 --- a/py/test/Ice/servantLocator/Client.py +++ b/py/test/Ice/servantLocator/Client.py @@ -10,13 +10,6 @@ import os, sys -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, AllTests diff --git a/py/test/Ice/servantLocator/Collocated.py b/py/test/Ice/servantLocator/Collocated.py index 1cd88fe9f5e..5d4a6455f28 100755 --- a/py/test/Ice/servantLocator/Collocated.py +++ b/py/test/Ice/servantLocator/Collocated.py @@ -10,13 +10,6 @@ import os, sys, traceback, time -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, TestI, AllTests diff --git a/py/test/Ice/servantLocator/Server.py b/py/test/Ice/servantLocator/Server.py index 08abc51e980..54989423a63 100755 --- a/py/test/Ice/servantLocator/Server.py +++ b/py/test/Ice/servantLocator/Server.py @@ -10,13 +10,6 @@ import os, sys, traceback, time -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('Test.ice') import Test, TestI diff --git a/py/test/Ice/servantLocator/ServerAMD.py b/py/test/Ice/servantLocator/ServerAMD.py index 92a3e9155bb..5e3ba8c5035 100755 --- a/py/test/Ice/servantLocator/ServerAMD.py +++ b/py/test/Ice/servantLocator/ServerAMD.py @@ -10,13 +10,6 @@ import os, sys, traceback, time -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('TestAMD.ice') import Test, TestAMDI diff --git a/py/test/Ice/slicing/exceptions/Client.py b/py/test/Ice/slicing/exceptions/Client.py index 01c3a6979e7..d274b4f4a83 100755 --- a/py/test/Ice/slicing/exceptions/Client.py +++ b/py/test/Ice/slicing/exceptions/Client.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice, AllTests def run(args, communicator): diff --git a/py/test/Ice/slicing/exceptions/Server.py b/py/test/Ice/slicing/exceptions/Server.py index 9e4e6ccc796..97623902213 100755 --- a/py/test/Ice/slicing/exceptions/Server.py +++ b/py/test/Ice/slicing/exceptions/Server.py @@ -9,14 +9,6 @@ # ********************************************************************** import os, sys, traceback - -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('-I. --all ServerPrivate.ice') import Test diff --git a/py/test/Ice/slicing/exceptions/ServerAMD.py b/py/test/Ice/slicing/exceptions/ServerAMD.py index e3ffecca749..5f51a6aa828 100755 --- a/py/test/Ice/slicing/exceptions/ServerAMD.py +++ b/py/test/Ice/slicing/exceptions/ServerAMD.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('-I. --all ServerPrivateAMD.ice') import Test diff --git a/py/test/Ice/slicing/objects/Client.py b/py/test/Ice/slicing/objects/Client.py index 01c3a6979e7..d274b4f4a83 100755 --- a/py/test/Ice/slicing/objects/Client.py +++ b/py/test/Ice/slicing/objects/Client.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice, AllTests def run(args, communicator): diff --git a/py/test/Ice/slicing/objects/Server.py b/py/test/Ice/slicing/objects/Server.py index b7d6ee15d47..5543d0c831e 100755 --- a/py/test/Ice/slicing/objects/Server.py +++ b/py/test/Ice/slicing/objects/Server.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('-I. --all ServerPrivate.ice Forward.ice') import Test diff --git a/py/test/Ice/slicing/objects/ServerAMD.py b/py/test/Ice/slicing/objects/ServerAMD.py index 54860e7cd1c..46c2f133a84 100755 --- a/py/test/Ice/slicing/objects/ServerAMD.py +++ b/py/test/Ice/slicing/objects/ServerAMD.py @@ -10,13 +10,6 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice Ice.loadSlice('-I. --all ServerPrivateAMD.ice Forward.ice') import Test diff --git a/py/test/Ice/timeout/Client.py b/py/test/Ice/timeout/Client.py index bdbb599c5dd..00a29ee9dd4 100755 --- a/py/test/Ice/timeout/Client.py +++ b/py/test/Ice/timeout/Client.py @@ -10,22 +10,11 @@ import os, sys, traceback -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +import Ice +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) - -import Ice Ice.loadSlice('-I' + slice_dir + ' Test.ice') import AllTests diff --git a/py/test/Ice/timeout/Server.py b/py/test/Ice/timeout/Server.py index 40058144efe..631c6aea27e 100755 --- a/py/test/Ice/timeout/Server.py +++ b/py/test/Ice/timeout/Server.py @@ -10,20 +10,9 @@ import os, sys, traceback, time, threading -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.normpath(toplevel) - if os.path.exists(os.path.join(toplevel, "python", "Ice.py")): - break -else: - raise "can't find toplevel directory!" - import Ice - -# -# Get Slice directory. -# -slice_dir = os.path.join(os.path.join(toplevel, "..", "slice")) -if not os.path.exists(slice_dir): +slice_dir = Ice.getSliceDir() +if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) diff --git a/rb/ruby/Ice.rb b/rb/ruby/Ice.rb index b09e58dd8f6..0d30fb74e13 100644 --- a/rb/ruby/Ice.rb +++ b/rb/ruby/Ice.rb @@ -11,6 +11,50 @@ require 'IceRuby' require 'thread' module Ice + + # + # Convenience function for locating the directory containing the + # Slice files. + # + def Ice.getSliceDir + # + # Get the parent of the directory containing this file + # (Ice.rb). + # + rbHome = File::join(File::dirname(__FILE__), "..") + + # + # For an installation from a source distribution, a binary + # tarball, or a Windows installer, the "slice" directory is a + # sibling of the "rb" directory. + # + dir = File::join(rbHome, "slice") + if File::exists?(dir) + return File::expand_path(dir) + end + + # + # In a source distribution, the "slice" directory is one level + # higher. + # + dir = File::join(rbHome, "..", "slice") + if File::exists?(dir) + return File::expand_path(dir) + end + + if RUBY_PLATFORM =~ /linux/i + iceVer = Ice::stringVersion + # + # Check the default RPM location. + # + dir = File::join("/", "usr", "share", "Ice-" + iceVer, "slice") + if File::exists?(dir) + return dir + end + end + + return nil + end # # Exceptions. # diff --git a/rb/test/Ice/binding/Client.rb b/rb/test/Ice/binding/Client.rb index 80ff9bd4941..f9d277e7b43 100755 --- a/rb/test/Ice/binding/Client.rb +++ b/rb/test/Ice/binding/Client.rb @@ -9,20 +9,8 @@ # ********************************************************************** require 'pathname' - -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - path = Pathname.new(toplevel).join("ruby", "Ice.rb") - if path.file? - rubyDir = Pathname.new(toplevel).join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" -end - require 'Ice' + Ice::loadSlice('Test.ice') require 'AllTests' diff --git a/rb/test/Ice/checksum/Client.rb b/rb/test/Ice/checksum/Client.rb index 7d2b38dc481..6c7fac3383b 100755 --- a/rb/test/Ice/checksum/Client.rb +++ b/rb/test/Ice/checksum/Client.rb @@ -9,34 +9,13 @@ # ********************************************************************** require 'pathname' +require 'Ice' -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - toplevel = Pathname.new(toplevel) - path = toplevel.join("ruby", "Ice.rb") - if path.file? - rubyDir = toplevel.join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" -end - -# -# Find Slice directory. -# -slice_dir = '' -if ENV.has_key?('ICE_HOME') and Pathname.new(ENV['ICE_HOME']).join("slice").directory? - slice_dir = ENV['ICE_HOME'] + '/slice' -elsif toplevel.join("..", "slice").directory? - slice_dir = toplevel.join("..", "slice") -else - puts $0 + ': Slice directory not found. Define ICERB_HOME or ICE_HOME.' - exit(1) +slice_dir = Ice.getSliceDir +if not slice_dir: + fail "Slice directory not found" end -require 'Ice' Ice::loadSlice('-I' + slice_dir + ' --checksum Test.ice CTypes.ice') require 'AllTests' diff --git a/rb/test/Ice/exceptions/Client.rb b/rb/test/Ice/exceptions/Client.rb index ca8ceade740..2a25742fc51 100755 --- a/rb/test/Ice/exceptions/Client.rb +++ b/rb/test/Ice/exceptions/Client.rb @@ -10,18 +10,6 @@ require 'pathname' -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - path = Pathname.new(toplevel).join("ruby", "Ice.rb") - if path.file? - rubyDir = Pathname.new(toplevel).join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" -end - require 'Ice' Ice::loadSlice('Test.ice') require 'AllTests' diff --git a/rb/test/Ice/facets/Client.rb b/rb/test/Ice/facets/Client.rb index 4fa05b709b2..b9e3e9e929f 100755 --- a/rb/test/Ice/facets/Client.rb +++ b/rb/test/Ice/facets/Client.rb @@ -9,19 +9,6 @@ # ********************************************************************** require 'pathname' - -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - path = Pathname.new(toplevel).join("ruby", "Ice.rb") - if path.file? - rubyDir = Pathname.new(toplevel).join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" -end - require 'Ice' Ice::loadSlice('Test.ice') require 'AllTests' diff --git a/rb/test/Ice/inheritance/Client.rb b/rb/test/Ice/inheritance/Client.rb index 2d6405e0583..7575afe3ba5 100755 --- a/rb/test/Ice/inheritance/Client.rb +++ b/rb/test/Ice/inheritance/Client.rb @@ -9,19 +9,6 @@ # ********************************************************************** require 'pathname' - -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - path = Pathname.new(toplevel).join("ruby", "Ice.rb") - if path.file? - rubyDir = Pathname.new(toplevel).join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" -end - require 'Ice' Ice::loadSlice('Test.ice') require 'AllTests' diff --git a/rb/test/Ice/location/Client.rb b/rb/test/Ice/location/Client.rb index 8875ddd4ff8..51539c2cd1a 100755 --- a/rb/test/Ice/location/Client.rb +++ b/rb/test/Ice/location/Client.rb @@ -10,32 +10,12 @@ require 'pathname' -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - path = Pathname.new(toplevel).join("ruby", "Ice.rb") - if path.file? - rubyDir = Pathname.new(toplevel).join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" -end - -# -# Find Slice directory. -# -slice_dir = '' -if ENV.has_key?('ICE_HOME') and Pathname.new(ENV['ICE_HOME']).join("slice").directory? - slice_dir = ENV['ICE_HOME'] + '/slice' -elsif Pathname.new(toplevel + '/../slice').directory? - slice_dir = toplevel + '/../slice' -else - puts $0 + ': Slice directory not found. Define ICERB_HOME or ICE_HOME.' - exit(1) +require 'Ice' +slice_dir = Ice.getSliceDir +if not slice_dir: + fail "Slice directory not found" end -require 'Ice' Ice::loadSlice('-I' + slice_dir + ' Test.ice') require 'AllTests' diff --git a/rb/test/Ice/objects/Client.rb b/rb/test/Ice/objects/Client.rb index 78414aab62d..a804788490f 100755 --- a/rb/test/Ice/objects/Client.rb +++ b/rb/test/Ice/objects/Client.rb @@ -9,19 +9,6 @@ # ********************************************************************** require 'pathname' - -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - path = Pathname.new(toplevel).join("ruby", "Ice.rb") - if path.file? - rubyDir = Pathname.new(toplevel).join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" -end - require 'Ice' Ice::loadSlice('Test.ice') Ice::loadSlice('ClientPrivate.ice') diff --git a/rb/test/Ice/operations/Client.rb b/rb/test/Ice/operations/Client.rb index d66074a8939..3fd327f05e4 100755 --- a/rb/test/Ice/operations/Client.rb +++ b/rb/test/Ice/operations/Client.rb @@ -9,33 +9,9 @@ # ********************************************************************** require 'pathname' - -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - path = Pathname.new(toplevel).join("ruby", "Ice.rb") - if path.file? - rubyDir = Pathname.new(toplevel).join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" -end - -# -# Find Slice directory. -# -slice_dir = '' -if ENV.has_key?('ICE_HOME') and Pathname.new(ENV['ICE_HOME']).join("slice").directory? - slice_dir = ENV['ICE_HOME'] + '/slice' -elsif Pathname.new(toplevel + '/../slice').directory? - slice_dir = toplevel + '/../slice' -else - puts $0 + ': Slice directory not found. Define ICERB_HOME or ICE_HOME.' - exit(1) -end - require 'Ice' + +slice_dir = Ice.getSliceDir Ice::loadSlice('-I' + slice_dir + ' Test.ice') require 'AllTests' diff --git a/rb/test/Ice/proxy/Client.rb b/rb/test/Ice/proxy/Client.rb index 32e5c8ff367..0407b98c2d5 100755 --- a/rb/test/Ice/proxy/Client.rb +++ b/rb/test/Ice/proxy/Client.rb @@ -9,33 +9,12 @@ # ********************************************************************** require 'pathname' - -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - path = Pathname.new(toplevel).join("ruby", "Ice.rb") - if path.file? - rubyDir = Pathname.new(toplevel).join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" -end - -# -# Find Slice directory. -# -slice_dir = '' -if ENV.has_key?('ICE_HOME') and Pathname.new(ENV['ICE_HOME']).join("slice").directory? - slice_dir = ENV['ICE_HOME'] + '/slice' -elsif Pathname.new(toplevel + '/../slice').directory? - slice_dir = toplevel + '/../slice' -else - puts $0 + ': Slice directory not found. Define ICERB_HOME or ICE_HOME.' - exit(1) +require 'Ice' +slice_dir = Ice.getSliceDir +if not slice_dir: + fail "Slice directory not found" end -require 'Ice' Ice::loadSlice('-I' + slice_dir + ' Test.ice') require 'AllTests' diff --git a/rb/test/Ice/retry/Client.rb b/rb/test/Ice/retry/Client.rb index b8975f6e8be..9eb83694976 100755 --- a/rb/test/Ice/retry/Client.rb +++ b/rb/test/Ice/retry/Client.rb @@ -9,33 +9,16 @@ # ********************************************************************** require 'pathname' - -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - path = Pathname.new(toplevel).join("ruby", "Ice.rb") - if path.file? - rubyDir = Pathname.new(toplevel).join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" +require 'Ice' +# The tests shouldn't use ICE_HOME unless USE_BIN_DIST=yes is set. +if ENV::has_key?("ICE_HOME") and ENV["USE_BIN_DIST"] != "yes" + ENV.delete("ICE_HOME") end - -# -# Find Slice directory. -# -slice_dir = '' -if ENV.has_key?('ICE_HOME') and Pathname.new(ENV['ICE_HOME']).join("slice").directory? - slice_dir = ENV['ICE_HOME'] + '/slice' -elsif Pathname.new(toplevel + '/../slice').directory? - slice_dir = toplevel + '/../slice' -else - puts $0 + ': Slice directory not found. Define ICERB_HOME or ICE_HOME.' - exit(1) +slice_dir = Ice.getSliceDir +if not slice_dir: + fail "Slice directory not found" end -require 'Ice' Ice::loadSlice('-I' + slice_dir + ' Test.ice') require 'AllTests' diff --git a/rb/test/Ice/slicing/exceptions/Client.rb b/rb/test/Ice/slicing/exceptions/Client.rb index 05c3b2f8d63..e5a062195ec 100755 --- a/rb/test/Ice/slicing/exceptions/Client.rb +++ b/rb/test/Ice/slicing/exceptions/Client.rb @@ -9,19 +9,6 @@ # ********************************************************************** require 'pathname' - -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - path = Pathname.new(toplevel).join("ruby", "Ice.rb") - if path.file? - rubyDir = Pathname.new(toplevel).join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" -end - require 'Ice' Ice::loadSlice('Test.ice') require 'AllTests' diff --git a/rb/test/Ice/slicing/objects/Client.rb b/rb/test/Ice/slicing/objects/Client.rb index 9e3015d5121..a00ea876f99 100755 --- a/rb/test/Ice/slicing/objects/Client.rb +++ b/rb/test/Ice/slicing/objects/Client.rb @@ -9,19 +9,6 @@ # ********************************************************************** require 'pathname' - -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - path = Pathname.new(toplevel).join("ruby", "Ice.rb") - if path.file? - rubyDir = Pathname.new(toplevel).join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" -end - require 'AllTests' def run(args, communicator) diff --git a/rb/test/Ice/timeout/Client.rb b/rb/test/Ice/timeout/Client.rb index 2bf27ff9d4e..9841003aecf 100755 --- a/rb/test/Ice/timeout/Client.rb +++ b/rb/test/Ice/timeout/Client.rb @@ -9,33 +9,12 @@ # ********************************************************************** require 'pathname' - -rubyDir = nil -for toplevel in [".", "..", "../..", "../../..", "../../../.."] - path = Pathname.new(toplevel).join("ruby", "Ice.rb") - if path.file? - rubyDir = Pathname.new(toplevel).join("ruby") - break - end -end -if not rubyDir - fail "can't find toplevel directory!" -end - -# -# Find Slice directory. -# -slice_dir = '' -if ENV.has_key?('ICE_HOME') and Pathname.new(ENV['ICE_HOME']).join("slice").directory? - slice_dir = ENV['ICE_HOME'] + '/slice' -elsif Pathname.new(toplevel + '/../slice').directory? - slice_dir = toplevel + '/../slice' -else - puts $0 + ': Slice directory not found. Define ICERB_HOME or ICE_HOME.' - exit(1) +require 'Ice' +slice_dir = Ice.getSliceDir +if not slice_dir: + fail "Slice directory not found" end -require 'Ice' Ice::loadSlice('-I' + slice_dir + ' Test.ice') require 'AllTests' |