brettviren / worch

Let the orchestration waf through the suite.
5 stars 3 forks source link

Self-contained, self-extracting version of worch. #32

Open brettviren opened 11 years ago

brettviren commented 11 years ago

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 copy waf into your top-level worch/ directory then

cd tests/test_zip
./pkg.sh

This will do the bundling under tmp/ and produce a self-extracting Python program called worch in test/. It will then run this program three times. Once to unpack its contents then to do a configure and build. The configuration files are taken from the simple-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. The worch bundle consists of a copy of the waf program (which itself is bundled with its own self-extraction method), the orch module code as an orch.zip file, the main wscript file and the configuration files as a cfg.zip file.

The resulting worch program can be run much like the bare waf program. If waf's .waf-* sub-directory does not exist then worch unbundles itself, runs waf to produce this sub-directory, adds the orch module next-door to waflib, unpacks the wscrip and cfg files and clean up any unpacked intermediaries. This clean up includes removing waf itself as worch 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.

brettviren commented 10 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.