Can pickle and load install data object.

pull/15/head
Jussi Pakkanen 12 years ago
parent 3deb31ebd5
commit c5b3d913a3
  1. 15
      builder_install.py
  2. 13
      generators.py

@ -14,10 +14,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import sys, pickle
class InstallData():
def __init__(self, src_dir, build_dir):
self.src_dir = src_dir
self.build_dir = build_dir
def do_install(datafilename):
ifile = open(datafilename, 'rb')
d = pickle.load(ifile)
if __name__ == '__main__':
if len(sys.argv) != 2:
print('Installer script for Builder. Do not run on your own, mmm\'kay?')
print('%s [install info file]' % sys.argv[0])
datafile = sys.argv[1]
datafilename = sys.argv[1]
do_install(datafilename)

@ -14,8 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os, stat, re
import os, stat, re, pickle
import interpreter, nodes
from builder_install import InstallData
def shell_quote(cmdlist):
return ["'" + x + "'" for x in cmdlist]
@ -167,7 +168,14 @@ class NinjaGenerator(Generator):
install_data = os.path.join(self.environment.get_scratch_dir(), 'install.dat')
outfile.write('build install: CUSTOM_COMMAND | all\n')
outfile.write(" COMMAND = '%s' '%s'\n\n" % (ninja_quote(install_script), ninja_quote(install_data)))
self.generate_install_data(outfile, install_data)
def generate_install_data(self, outfile, install_data_file):
#d['source_dir'] = self.environment.get_source_dir()
#d['build_dir'] = self.environment.get_build_dir()
d = InstallData(self.environment.get_source_dir(), self.environment.get_build_dir())
ofile = open(install_data_file, 'wb')
pickle.dump(d, ofile)
def generate_tests(self, outfile):
script_root = self.get_script_root()
@ -197,7 +205,6 @@ class NinjaGenerator(Generator):
rule = 'rule STATIC_LINKER\n'
command = ' command = %s $LINK_FLAGS $out $in\n' % \
' '.join(static_linker.get_exelist())
description = ' description = Static linking library $out\n\n'
outfile.write(rule)
outfile.write(command)

Loading…
Cancel
Save