@@ -15,6 +15,7 @@ import zipfile
15
15
import shutil
16
16
import logging
17
17
import tempfile
18
+ import subprocess
18
19
try:
19
20
from urllib.request import pathname2url as pathname2url
20
21
except ImportError:
@@ -84,8 +85,6 @@ def call_subprocess(cmd, options, stdout=False, cwd=None, env=None):
84
85
"""
85
86
A wrapper for subprocess.Popen that manages I/O in a consistent manner.
86
87
"""
87
- import subprocess
88
-
89
88
if env is None:
90
89
env = os.environ.copy()
91
90
#
@@ -281,7 +280,7 @@ def install_virtualenv(options, srcdir=None, pip=None, pip_src=None):
281
280
return pip, python_dir
282
281
283
282
284
- def install_from_trunk (pip, options):
283
+ def install_from_trunk_vpy (pip, options):
285
284
"""
286
285
Installing from trunk (with vpy_install).
287
286
"""
@@ -331,6 +330,41 @@ def install_from_trunk(pip, options):
331
330
return pip
332
331
333
332
333
+ def install_from_trunk_jython(pip, python_dir, options):
334
+ """
335
+ Install from PyPI or from Zip File
336
+ """
337
+ if options.venv:
338
+ pip, python_dir = install_virtualenv(options, pip=pip)
339
+ if options.venvonly:
340
+ return
341
+ options.venv = False
342
+ #
343
+ # Setup the sourc directory
344
+ #
345
+ srcDir = os.path.join(python_dir, 'src')
346
+ if not os.path.exists( srcDir ):
347
+ os.mkdir( srcDir )
348
+ python_executable = os.path.basename(sys.executable)
349
+ python = os.path.join(python_dir, 'bin', python_executable)
350
+ #
351
+ # Install 'nose' first
352
+ #
353
+ call_subprocess([pip, 'instally','nose'], options)
354
+ #
355
+ # Clone and install PyUtilib
356
+ #
357
+ cmd = [ 'git', 'clone', '-q', 'https://github.com/PyUtilib/pyutilib.git']
358
+ call_subprocess(cmd, options, cwd=srcDir)
359
+ call_subprocess([python, 'setup.py','develop'], options, cwd=os.path.join(srcDir,'pyutilib'))
360
+ #
361
+ # Checkout and install Pyomo
362
+ #
363
+ cmd = [ 'svn', 'checkout', '-q', 'https://software.sandia.gov/svn/public/pyomo/pyomo/trunk', 'pyomo' ]
364
+ call_subprocess(cmd, options, cwd=srcDir)
365
+ call_subprocess([python, 'setup.py','develop'], options, cwd=os.path.join(srcDir,'pyomo'))
366
+
367
+
334
368
def install_from_src(pip, srcdir, pip_src, python_dir, options):
335
369
#
336
370
# Install from PyPI or from Zip File
@@ -741,7 +775,10 @@ virtual python environment is created in the 'pyomo' directory.
741
775
# Install Pyomo
742
776
#
743
777
if options.trunk:
744
- pip = install_from_trunk(pip, options)
778
+ if getattr(subprocess,'jython',False):
779
+ pip = install_from_trunk_jython(pip, python_dir, options)
780
+ else:
781
+ pip = install_from_trunk_vpy(pip, options)
745
782
elif options.zipfile or options.srcdir:
746
783
offline = True # Force offline for now
747
784
pip = install_from_src(pip, srcdir, pip_src, python_dir, options)
0 commit comments