Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added creation of bin/pyjd[.bat] and fixes for win32

  • Loading branch information...
commit 582aac1f1124579e7738947c45f2d5497afd93e0 1 parent 7f77b18
@keesbos keesbos authored
Showing with 58 additions and 16 deletions.
  1. +11 −6 INSTALL.txt
  2. +47 −10 bootstrap.py
View
17 INSTALL.txt
@@ -69,11 +69,11 @@ In this directory run:
python bootstrap.py
-The files ``pyjd/__init__.py``, ``./bin/pyjsbuild`` and ``./bin/pyjscompile``
-will be created, custom-tailored with hard-coded paths specific to the exact
-absolute location that the bootstrap.py command is run from. In this way, you
-will be able to install, test and use multiple versions of Pyjamas, without
-cross-interference.
+The files ``pyjd/__init__.py``, ``./bin/pyjsbuild``, ``./bin/pyjscompile``
+and ``pyjd`` will be created, custom-tailored with hard-coded paths specific
+to the exact absolute location that the bootstrap.py command is run from.
+In this way, you will be able to install, test and use multiple versions
+of Pyjamas, without cross-interference.
As they contain hard-coded paths, these custom-tailored commands CANNOT
be "moved around". If you move the pyjamas installation, re-run bootstrap.py
@@ -81,6 +81,11 @@ to recreate the commands, with suitable hard-coded paths.
To build pyjamas apps see ``./bin/pyjsbuild --help``
+On windows the files ``pyjd/__init__.py``, ``./bin/pyjsbuild.py``,
+``./bin/pyjsbuild.bat``, ``./bin/pyjscompile.py`` ``./bin/pyjscompile.bat``
+and ``pyjd.bat`` will be created. The .bat files are the commands to be used. They invoke the corresponding .py files (if any).
+
+
Pyjamas Desktop
---------------
@@ -90,7 +95,7 @@ python bootstrap.py: see above).
There are two options for doing this:
-1) export PYTHONPATH={path to pyjamas}
+1) export PYTHONPATH={path to pyjamas} (or use bin/pyjd, which does this)
2) break the sandbox rules (specifically for pyjd) and run:
View
57 bootstrap.py
@@ -8,7 +8,7 @@
import os
import sys
-pyjsbuild = """#!%(exec)s
+pyjsbuild = """#!%(python)s
pyjsversion = r'%(ver)s'
pyjspth = r'%(pyjspth)s'
@@ -31,7 +31,7 @@
pyjs.browser.build_script()
"""
-pyjscompile = """#!%(exec)s
+pyjscompile = """#!%(python)s
pyjsversion = r'%(ver)s'
pyjspth = r'%(pyjspth)s'
@@ -52,7 +52,7 @@
pyjs.translator.main()
"""
-pyjampiler= """#!%(exec)s
+pyjampiler= """#!%(python)s
pyjsversion = r'%(ver)s'
pyjspth = r'%(pyjspth)s'
@@ -73,6 +73,19 @@
pyjs.pyjampiler.Builder()
"""
+pyjdsh = """#!/bin/sh
+
+PYJAMAS_HOME="%(pyjspth)s"
+PYJAMAS_SITE="%(pyjssitepth)s"
+if [ "Q${PYTHONPATH}" == "Q" ] ; then
+ export PYTHONPATH="${PYJAMAS_HOME}:${PYJAMAS_SITE}"
+else
+ export PYTHONPATH="${PYJAMAS_HOME}:${PYJAMAS_SITE}:${PYTHONPATH}"
+fi
+
+%(python)s $@
+"""
+
pyjdinitpth = os.path.join("pyjd", "__init__.py.in")
pyjdinit = open(pyjdinitpth, "r").read()
@@ -85,13 +98,36 @@
goto setArgs
:doneSetArgs
-python "%s.py" %%CMD_LINE_ARGS%%
+"%(python)s" "%(cmd)s.py" %%CMD_LINE_ARGS%%
+'''
+
+pyjdbat = '''@echo off
+
+set PYJAMAS_HOME=%(pyjspth)s
+set PYJAMAS_SITE=%(pyjssitepth)s
+
+set PYTHONPATH=%%PYJAMAS_HOME%%;%%PYJAMAS_SITE%%;%%PYTHONPATH%%
+
+set CMD_LINE_ARGS=
+:setArgs
+if ""%%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%%CMD_LINE_ARGS%% %%1
+shift
+goto setArgs
+:doneSetArgs
+
+"%(python)s" %%CMD_LINE_ARGS%%
'''
def make_cmd(prefix, pth, pyjsversion, pyjspth, cmdname, txt):
+ python = sys.executable
+ ver = pyjsversion
+ pyjssitepth = os.path.join(pyjspth, 'site-packages')
if sys.platform == 'win32':
cmd_name = cmdname + ".py"
+ if cmdname == 'pyjd':
+ cmd_name = 'pyjd.bat'
else:
cmd_name = cmdname
@@ -108,22 +144,19 @@ def make_cmd(prefix, pth, pyjsversion, pyjspth, cmdname, txt):
os.chmod(cmd, 0x1ed)
os.unlink(cmd)
f = open(cmd, "w")
- f.write(txt % {'exec': sys.executable,
- 'ver': pyjsversion,
- 'pyjspth': pyjspth,
- 'pth': pth})
+ f.write(txt % locals())
f.close()
if hasattr(os, "chmod"):
os.chmod(cmd, 0x16d)
- if sys.platform == 'win32':
+ if sys.platform == 'win32' and cmdname != 'pyjd':
cmd = os.path.join("bin", cmdname)
cmd = os.path.join(prefix, cmd)
cmd = os.path.abspath(cmd)
batcmd = "%s.bat" % cmd
f = open(batcmd, "w")
- f.write(batcmdtxt % cmd)
+ f.write(batcmdtxt % locals())
f.close()
if __name__ == '__main__':
@@ -153,3 +186,7 @@ def make_cmd(prefix, pth, pyjsversion, pyjspth, cmdname, txt):
f.write(pyjdinit % (version, pyjspth))
f.close()
+ if sys.platform == 'win32':
+ make_cmd(prefix, pth, version, pyjspth, "pyjd", pyjdbat)
+ else:
+ make_cmd(prefix, pth, version, pyjspth, "pyjd", pyjdsh)
Please sign in to comment.
Something went wrong with that request. Please try again.