aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuilder_install.py21
-rwxr-xr-xgenerators.py15
2 files changed, 31 insertions, 5 deletions
diff --git a/builder_install.py b/builder_install.py
index 8731443..bc32adf 100755
--- a/builder_install.py
+++ b/builder_install.py
@@ -23,6 +23,7 @@ class InstallData():
self.dep_prefix = dep_prefix
self.headers = []
self.man = []
+ self.data = []
def do_install(datafilename):
ifile = open(datafilename, 'rb')
@@ -30,6 +31,17 @@ def do_install(datafilename):
install_targets(d)
install_headers(d)
install_man(d)
+ install_data(d)
+
+def install_data(d):
+ for i in d.data:
+ fullfilename = i[0]
+ outfilename = i[1]
+ outdir = os.path.split(outfilename)[0]
+ os.makedirs(outdir, exist_ok=True)
+ print('Installing %s to %s.' % (fullfilename, outdir))
+ gzip.open(outfilename, 'w').write(open(fullfilename, 'rb').read())
+ shutil.copystat(fullfilename, outfilename)
def install_man(d):
for m in d.man:
@@ -38,18 +50,19 @@ def install_man(d):
outdir = os.path.split(outfilename)[0]
os.makedirs(outdir, exist_ok=True)
print('Installing %s to %s.' % (fullfilename, outdir))
- gzip.open(outfilename, 'w').write(open(fullfilename, 'rb').read())
-
+ shutil.copyfile(fullfilename, outfilename)
+ shutil.copystat(fullfilename, outfilename)
def install_headers(d):
for t in d.headers:
fullfilename = t[0]
outdir = t[1]
fname = os.path.split(fullfilename)[1]
- outname = os.path.join(outdir, fname)
+ outfilename = os.path.join(outdir, fname)
print('Installing %s to %s' % (fname, outdir))
os.makedirs(outdir, exist_ok=True)
- shutil.copyfile(fullfilename, outname)
+ shutil.copyfile(fullfilename, outfilename)
+ shutil.copystat(fullfilename, outfilename)
def install_targets(d):
for t in d.targets:
diff --git a/generators.py b/generators.py
index 9c4109f..ce381f9 100755
--- a/generators.py
+++ b/generators.py
@@ -174,7 +174,7 @@ class NinjaGenerator(Generator):
self.generate_target_install(d)
self.generate_header_install(d)
self.generate_man_install(d)
- #self.generate_data_install(outfile)
+ self.generate_data_install(d)
ofile = open(install_data_file, 'wb')
pickle.dump(d, ofile)
@@ -218,6 +218,19 @@ class NinjaGenerator(Generator):
i = [srcabs, dstabs]
d.man.append(i)
+ def generate_data_install(self, d):
+ prefix = self.environment.get_prefix()
+ dataroot = os.path.join(prefix, self.environment.get_datadir())
+ data = self.build.get_data()
+ for de in data:
+ subdir = os.path.join(dataroot, de.get_subdir())
+ absdir = os.path.join(self.environment.get_prefix(), subdir)
+ for f in de.get_sources():
+ srcabs = os.path.join(self.environment.get_source_dir(), f)
+ dstabs = os.path.join(absdir, f)
+ i = [srcabs, dstabs]
+ d.data.append(i)
+
def generate_tests(self, outfile):
script_root = self.get_script_root()
test_script = os.path.join(script_root, 'builder_test.py')