From e71f22aba1235b58ef8fa6c886600fb4ff5093d1 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 24 Jun 2016 13:34:27 -0400 Subject: [PATCH] [SCons] Install license file with licenses for 3rd-party code --- ext/SConscript | 31 +++++++++++++++++++++++++++++++ platform/windows/License.rtf | Bin 2121 -> 0 bytes site_scons/wxsgen.py | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) delete mode 100644 platform/windows/License.rtf diff --git a/ext/SConscript b/ext/SConscript index 1af49d819..09f5e576d 100644 --- a/ext/SConscript +++ b/ext/SConscript @@ -3,6 +3,8 @@ from buildutils import * Import('env', 'build', 'install', 'libraryTargets') localenv = env.Clone() +license_files = [('Cantera', '#License.txt')] + def prep_default(env): localenv = env.Clone() @@ -22,6 +24,7 @@ def prep_gtest(env): def prep_fmt(env): localenv = prep_default(env) + license_files.append(('fmtlib', 'fmt/LICENSE.rst')) build(localenv.Command("#include/cantera/ext/format.h", "#ext/fmt/fmt/format.h", Copy('$TARGET', '$SOURCE'))) @@ -39,6 +42,7 @@ for subdir, extensions, prepFunction in libs: if env['system_sundials'] == 'n': localenv = prep_default(env) localenv.Prepend(CPPPATH=Dir('#include/cantera/ext')) + license_files.append(('Sundials', 'sundials/LICENSE')) # Generate sundials_config.h sundials_configh = {} @@ -67,6 +71,7 @@ if env['system_sundials'] == 'n': if not any(pattern in f.name for pattern in exclude)])) if not env['system_eigen']: + license_files.append(('Eigen', 'eigen/COPYING.MPL2')) build(localenv.Command('#include/cantera/ext/Eigen', '#ext/eigen/Eigen', Copy('$TARGET', '$SOURCE'))) @@ -75,3 +80,29 @@ if not env['system_googletest']: localenv = prep_gtest(env) gtest = build(localenv.Library('../lib/gtest', source=['googletest/src/gtest-all.cc'])) + +# Create license file containing licenses for Cantera and all included packages +def generate_license(target, source, env): + stars = '*'*50 + '\n' + '*'*50 + '\n' + tpl = stars + 'The following license applies to {}\n' + stars + '\n{}\n' + + license = [] + for (package,_),filename in zip(license_files, source): + license.append(tpl.format(package, open(filename.path).read().strip())) + + license = '\n'.join(license) + if target[0].path.endswith('.rtf'): + license = license.replace('\\', '\\\\').replace('{', '\\{').replace('}', '\\}') + license = license.replace('\n', ' \\par\n') + license = r'{\rtf1\ansi{\fonttbl\f0\fswiss Arial;}\f0\pard\fs16 ' + license + '}' + + open(target[0].path, 'w').write(license) + +license = build(localenv.Command('LICENSE.txt', [x[1] for x in license_files], + generate_license)) +install('$inst_docdir', license) + +if env['OS'] == 'Windows': + # RTF version is required for Windows installer + build(localenv.Command('LICENSE.rtf', [x[1] for x in license_files], + generate_license)) diff --git a/platform/windows/License.rtf b/platform/windows/License.rtf deleted file mode 100644 index 6461b9d15c8dbb971a4f1381de06ea97c586ee4d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2121 zcmbtVTTk0a6yE1b{D-5yY+Hq_6JWPpo*a8fMsn<|FHj`EIQE!~*6~F41d0&&uUYJsHzg?^5{PFSV-9!E${>8Z_|q*dapaV-Wvu4PPFd@ z0i%bPrLa3|*%sYBLCS4E8ajt%hJo5^+Nw&{va}M62&l9Jd8y$i?K*WUD=hS;(3V=Q znnvBp_J&FY0S#(zA8m#H`=#*K?1y~UYVl2*DE&VBE7!#ux%z}%e45*4-DoUuxN8v- zNQHdj#W%e+*B>AAS{|SL>Ew;XH~mP~%5`8_s!Gsy-#`Tb7%jjG2^wVS*dbw z!e)Imw*LW-6;3+Z7KpPfn*P~O8(;hEMSKSPenl}92+LtK+G1;`(7b+oLPx(C5*RT| znJHy$9Qrg~3|UrPkFM`&Elix@iXzcg*adQDSZo!33I<6rH<((9!KWGrgS$@?^gZSM zPLw9*cqC2uI}`ABh3zL0M zDJ`PFXK_Mq=wmlbV?N8$2pjL+1TWv)12?=T_H`ArB%vrKzFY+y#ZWzV!<4gRL_G9@ z%;({JL?}RElv2Q#JjJy%8d=cS&nUW}C5ycUs<<;A@buc^UGOwCSQh|uY30T#_p-o^ zX_dvRC}Cu1`8@FgmoJ$=209RlU9vExWZ?$EPb{OWkj19;A1KZkdUR(28-PI4=P~nA z!{&MAK{&J*AP+0%akF4w86(QZR!v4u{35VpnOLxu^`tXJ#u*Az^wlpn6h9sLM zDNnPM(L9QLt8>EQOYX7coPx+Ge?eKoMnFhi3ycy_3dbNe%Mxxi<6+9;I9sJW3O~Z$ zE2skAE}r^U+$h8!8-pmmHbspFR{IfMEg0efhr>ZB*NBlI6rQp3`!(PpBk40m3fVm1 za~68cG!vO3S3F@K;S@(>b5qfvUb%ooJ^*WSh^B_+i@ZW!_(=SMT>la^{HM!sKH-Oy TSjD`>LG2e4aP$uU;eY!N=|;6d diff --git a/site_scons/wxsgen.py b/site_scons/wxsgen.py index e53c03e2f..ec3df0c27 100644 --- a/site_scons/wxsgen.py +++ b/site_scons/wxsgen.py @@ -163,7 +163,7 @@ class WxsGenerator(object): # License et.SubElement(product, 'WixVariable', - dict(Id='WixUILicenseRtf', Value='platform/windows/License.rtf')) + dict(Id='WixUILicenseRtf', Value='build/ext/LICENSE.rtf')) # Format and save as XML indent(wix)