Commits

Anonymous committed bcd4e56

Necessary changes towards supporting Jython.

Comments (0)

Files changed (79)

     if re.compile("^" + res + "$", re.DOTALL).match(lines):
         return 1
 
+if os.name == 'java':
+
+    python_executable = os.path.join(sys.prefix, 'jython')
+
+else:
+
+    python_executable = sys.executable
+
 if sys.platform == 'win32':
 
     def where_is(file, path=None, pathext=None):
 
 import TestCmd
 
+python = TestCmd.python_executable
+
 class TestFailed(Exception):
     def __init__(self, args=None):
         self.args = args
                 else:
                     kw['program'] = 'scons.py'
 	if not kw.has_key('interpreter') and not os.environ.get('SCONS_EXEC'):
-	    kw['interpreter'] = sys.executable
+	    kw['interpreter'] = python
 	if not kw.has_key('match'):
 	    kw['match'] = TestCmd.match_exact
 	if not kw.has_key('workdir'):
 #                       is intended for use in the batch_test_command
 #                       field in the Aegis project config file.
 #
+#	-P Python	Use the specified Python interpreter.
+#
 #	-p package	Test against the specified package.
 #
 #	-q		Quiet.  By default, runtest.py prints the
 scons_exec = None
 output = None
 
+if os.name == 'java':
+    python = os.path.join(sys.prefix, 'jython')
+else:
+    python = sys.executable
+
 cwd = os.getcwd()
 
-if sys.platform == 'win32':
-    lib_dir = os.path.join(sys.exec_prefix, "lib")
+if sys.platform == 'win32' or os.name == 'java':
+    lib_dir = os.path.join(sys.exec_prefix, "Lib")
 else:
     # The hard-coded "python" here is the directory name,
     # not an executable, so it's all right.
   -d, --debug                 Run test scripts under the Python debugger.
   -h, --help                  Print this message and exit.
   -o FILE, --output FILE      Print test results to FILE (Aegis format).
+  -P Python                   Use the specified Python interpreter.
   -p PACKAGE, --package PACKAGE
                               Test against the specified PACKAGE:
                                 deb           Debian
   -x SCRIPT, --exec SCRIPT    Test SCRIPT.
 """
 
-opts, args = getopt.getopt(sys.argv[1:], "adho:p:qXx:",
+opts, args = getopt.getopt(sys.argv[1:], "adho:P:p:qXx:",
                             ['all', 'debug', 'help', 'output=',
-                             'package=', 'quiet', 'exec='])
+                             'package=', 'python=', 'quiet', 'exec='])
 
 for o, a in opts:
     if o == '-a' or o == '--all':
         if not os.path.isabs(a):
             a = os.path.join(cwd, a)
         output = a
+    elif o == '-P' or o == '--python':
+        python = a
     elif o == '-p' or o == '--package':
         package = a
     elif o == '-q' or o == '--quiet':
 sys.stdout = Unbuffered(sys.stdout)
 
 for t in tests:
-    cmd = string.join([sys.executable, debug, t.abspath], " ")
+    cmd = string.join([python, debug, t.abspath], " ")
     if printcmd:
         sys.stdout.write(cmd + "\n")
     s = os.system(cmd)

src/engine/SCons/ActionTests.py

     def items(self):
         return self.d.items()
 
-python = sys.executable
+if os.name == 'java':
+    python = os.path.join(sys.prefix, 'jython')
+else:
+    python = sys.executable
 
 class ActionTestCase(unittest.TestCase):
 

src/engine/SCons/Platform/__init__.py

     files.  Since we're architecture independent, though, we don't
     care about the machine architecture.
     """
-    if os.name == 'posix':
+    osname = os.name
+    if osname == 'java':
+        osname = os._osType
+    if osname == 'posix':
         if sys.platform == 'cygwin':
             return 'cygwin'
         return 'posix'
     """
     full_name = 'SCons.Platform.' + name
     if not sys.modules.has_key(full_name):
-        try:
-            file, path, desc = imp.find_module(name,
+        if os.name == 'java':
+            eval(full_name)
+        else:
+            try:
+                file, path, desc = imp.find_module(name,
                                         sys.modules['SCons.Platform'].__path__)
-            imp.load_module(full_name, file, path, desc)
-        except ImportError:
-            raise SCons.Errors.UserError, "No platform named '%s'" % name
-        if file:
-            file.close()
+                imp.load_module(full_name, file, path, desc)
+            except ImportError:
+                raise SCons.Errors.UserError, "No platform named '%s'" % name
+            if file:
+                file.close()
     return sys.modules[full_name]
 
 def DefaultToolList(platform, env):

src/engine/SCons/Script/__init__.py

 
         def opt_debug(option, opt, value, parser):
             if value == "pdb":
-                args = [ sys.executable, "pdb.py" ] + \
+                if os.name == 'java':
+                    python = os.path.join(sys.prefix, 'jython')
+                else:
+                    python = sys.executable
+                args = [ python, "pdb.py" ] + \
                        filter(lambda x: x != "--debug=pdb", sys.argv)
                 if sys.platform == 'win32':
                     args[1] = os.path.join(sys.prefix, "lib", "pdb.py")
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import TestSCons
 import TestCmd
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons(match=TestCmd.match_re)
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'

test/CFILESUFFIX.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'

test/CXXFILESUFFIX.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 

test/CommandGenerator.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 test.write('SConstruct', """
 def g(source, target, for_signature, env):
     import sys
-    python = sys.executable
+    python = r"%s"
     return [[python, "build.py", "$TEMPFILE"] + source,
             [python, "build.py"] + target + ["$TEMPFILE"]]
 
 env.b(target = 'foo1.out', source = 'foo1.in')
 env.b(target = 'foo2.out', source = 'foo2.in')
 env.b(target = 'foo3.out', source = 'foo3.in')
-""")
+""" % python)
 
 test.write('foo1.in', "foo1.in\n")
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 

test/DVIPDFFLAGS.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 

test/DVIPSFLAGS.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 

test/Environment.py

 import TestSCons
 import sys
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 

test/LATEXFLAGS.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'

test/LINKFLAGS.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 

test/PDFLATEXFLAGS.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 

test/PDFTEXFLAGS.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 

test/ParseConfig.py

 print env['LIBS']
 print env['CCFLAGS']
 print static_libs
-""" % (sys.executable, test_config))
+""" % (TestSCons.python, test_config))
 
 test.write('SConstruct2', """
 env = Environment(CPPPATH = [], LIBPATH = [], LIBS = [], CCFLAGS = '')
 print env['LIBS']
 print env['CCFLAGS']
 print static_libs
-""" % (sys.executable, test_config))
+""" % (TestSCons.python, test_config))
 
 good_stdout = test.wrap_stdout(read_str = """\
 ['/usr/include/fum', 'bar']
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'

test/RANLIBFLAGS.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'

test/Repository/no-repository.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _obj = '.obj'

test/SHF77FLAGS.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _obj = '.obj'
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     lib_ = ''

test/SHLINKFLAGS.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     lib_ = ''
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'

test/YACCFLAGS.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 if sys.platform == 'win32':
     _exe = '.exe'
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 

test/builderrors.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import string
 import sys
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons(match = TestCmd.match_re_dotall)
 

test/multiline.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 

test/option--D.py

 import TestSCons
 import os
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 

test/option--Q.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 

test/option--U.py

 
 test = TestSCons.TestSCons()
 
-python = sys.executable
+python = TestSCons.python
 
 test.subdir('sub1', 'sub2', 'sub3')
 

test/option--debug.py

     return float(re.match(match, line).group(1))
 
 start_time = time.time()
-test.run(program=sys.executable, arguments='-c pass')
+test.run(program=TestSCons.python, arguments='-c pass')
 overhead = time.time() - start_time 
 
 start_time = time.time()

test/option--max-drift.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 try:
     import threading
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 
 test = TestSCons.TestSCons()
 
-python = sys.executable
+python = TestSCons.python
 
 test.write('build.py', r"""
 import sys
 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
 
 test = TestSCons.TestSCons()
 
-python = sys.executable
+python = TestSCons.python
 
 test.subdir('sub1', 'sub2', 'sub3')
 

test/overrides.py

 test = TestSCons.TestSCons()
 
 
-python = sys.executable
+python = TestSCons.python
 
 test.write('SConstruct', """
 env = Environment(LIBS=['a'])

test/scan-once.py

 import TestCmd
 import TestSCons
 
-#test = TestSCons.TestSCons(match = TestCmd.match_re)
 test = TestSCons.TestSCons()
 
 test.subdir('simple',

test/special-filenames.py

 env=Environment(BUILDERS = {'Build' : Builder(action = '%s cat.py $TARGET $SOURCE')})
 
 %s
-""" % (sys.executable, string.join(map(buildFileStr, file_names), '\n')))
+""" % (TestSCons.python, string.join(map(buildFileStr, file_names), '\n')))
 
 test.run(arguments='.')
 

test/up-to-date.py

 import sys
 import TestSCons
 
-python = sys.executable
+python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.