Open brettviren opened 11 years ago
The current worch bundling method is more of a kludge than I like. Now that waf tools and features are used worch is closer to being able to be packaged in a "proper" waf manner. However, the fact that worch is implemented by a Python module hierarchy runs afoul of waf's current bundling support.
I have a question in to the waf-users mailing list https://groups.google.com/forum/#!topic/waf-users/Omn7CNjkQLI about this.
So far what I can do is patch the waf/wscript file to explicitly load the orch (and extras) Python module hierarchy. This approach could be extended to including configuration files but it's not clear if it is actually desirable to go this far.
Waf is packaged as a self-extracting executable. It's desirable to add worch's orch/ module, a set of worch configuration files and the main wscript file to this bundling.
The
tests/test_zip/
test shows one way to do this. To run it, first copywaf
into your top-levelworch/
directory thenThis will do the bundling under
tmp/
and produce a self-extracting Python program calledworch
intest/
. It will then run this program three times. Once to unpack its contents then to do aconfigure
andbuild
. The configuration files are taken from thesimple-with-patch
example.The bundling works using Python's build-in
pkgutil.get_data()
method and Python's ability to append a zip file to some initial Python code. Theworch
bundle consists of a copy of thewaf
program (which itself is bundled with its own self-extraction method), theorch
module code as anorch.zip
file, the mainwscript
file and the configuration files as acfg.zip
file.The resulting
worch
program can be run much like the barewaf
program. If waf's.waf-*
sub-directory does not exist thenworch
unbundles itself, runs waf to produce this sub-directory, adds theorch
module next-door towaflib
, unpacks thewscrip
andcfg
files and clean up any unpacked intermediaries. This clean up includes removingwaf
itself asworch
also provides waf's main entrance.It remains to be seen if this approach is a good one or not. If so, then the next step would be to automate the production of this
worch
bundle somewhat more.