[pypy-commit] pypy packaging: append bits to LICENSE file
mattip
noreply at buildbot.pypy.org
Thu May 22 20:29:55 CEST 2014
Author: mattip <matti.picus at gmail.com>
Branch: packaging
Changeset: r71674:d998fb2217c4
Date: 2014-05-22 20:44 +0300
http://bitbucket.org/pypy/pypy/changeset/d998fb2217c4/
Log: append bits to LICENSE file
diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py
--- a/pypy/tool/release/package.py
+++ b/pypy/tool/release/package.py
@@ -55,27 +55,50 @@
# so no extra license needed?
with open(base_file) as fid:
txt = fid.read()
+ searches = [("bzip2","libbz2-*", "copyright"),
+ ("openssl", "openssl*", "copyright"),
+ ]
+ if not options.no_tk:
+ searches += [("tk", "tk-dev", "copyright"),
+ ("tcl", "tcl-dev", "copyright")]
+ for name, pat, file in searches:
+ txt += "="*40
+ txt += "\nThis copy of PyPy includes a copy of %s, which is licensed under the following terms:\n\n" % name
+ dirs = glob.glob(options.license_base + "/" +pat)
+ if not dirs:
+ raise ValueError, "Could not find "+ options.license_base + "/" + pat
+ if len(dirs) > 2:
+ raise ValueError, "Multiple copies of "+pat
+ dir = dirs[0]
+ with open(os.path.join(dir, file)) as fid:
+ # Read up to the ---- dividing the packaging header from the actual
+ # copyright (bzip) or 'LICENSE ISSUES' for openssl
+ for line in fid:
+ if (line.startswith('---------') or 'LICENSE ISSUES' in line):
+ break
+ txt += line
+ for line in fid:
+ txt += line
return txt
def generate_license_windows(base_file, options):
- # Do as cpython does
with open(base_file) as fid:
txt = fid.read()
- shutil.copyfileobj(open("crtlicense.txt"), out)
- for name, pat, file in (("bzip2","bzip2-*", "LICENSE"),
- ("openssl", "openssl-*", "LICENSE"),
- ("Tcl", "tcl-8*", "license.terms"),
- ("Tk", "tk-8*", "license.terms"),
- ("Tix", "tix-*", "license.terms")):
- txt += "\nThis copy of PyPy includes a copy of %s, which is licensed under the following terms:\n\n" % name
- dirs = glob.glob(options.license_base + "/" +pat)
- if not dirs:
- raise ValueError, "Could not find "+ options.license_base + "/" + pat
- if len(dirs) > 2:
- raise ValueError, "Multiple copies of "+pat
- dir = dirs[0]
- with open(os.path.join(dir, file)) as fid:
- txt += fid.read()
+ # shutil.copyfileobj(open("crtlicense.txt"), out) # We do not ship msvc runtime files
+ for name, pat, file in (("bzip2","bzip2-*", "LICENSE"),
+ ("openssl", "openssl-*", "LICENSE"),
+ ("Tcl", "tcl-8*", "license.terms"),
+ ("Tk", "tk-8*", "license.terms"),
+ ("Tix", "tix-*", "license.terms")):
+ txt += "\nThis copy of PyPy includes a copy of %s, which is licensed under the following terms:\n\n" % name
+ dirs = glob.glob(options.license_base + "/" +pat)
+ if not dirs:
+ raise ValueError, "Could not find "+ options.license_base + "/" + pat
+ if len(dirs) > 2:
+ raise ValueError, "Multiple copies of "+pat
+ dir = dirs[0]
+ with open(os.path.join(dir, file)) as fid:
+ txt += fid.read()
return txt
if sys.platform == 'win32':
diff --git a/pypy/tool/release/test/test_package.py b/pypy/tool/release/test/test_package.py
--- a/pypy/tool/release/test/test_package.py
+++ b/pypy/tool/release/test/test_package.py
@@ -106,12 +106,21 @@
check(file2, 0644)
check(pypy, 0755)
-def _test_generate_license():
- from os.path import dirname, abspath
+def test_generate_license():
+ from os.path import dirname, abspath, join
class Options(object):
pass
options = Options()
basedir = dirname(dirname(dirname(dirname(dirname(abspath(__file__))))))
- license = package.generate_license(str(basedir.join('LICENSE')), options)
- assert 'bzlib' in license
+ options.no_tk = False
+ if sys.platform == 'win32':
+ # Following recommended build setup at
+ # http://doc.pypy.org/en/latest/windows.html#abridged-method-for-ojit-builds-using-visual-studio-2008
+ options.license_base = dirname(basedir) + '/local'
+ else:
+ options.license_base = '/usr/share/doc'
+ license = package.generate_license(join(basedir,'LICENSE'), options)
+ assert 'bzip2' in license
+ assert 'openssl' in license
+ assert 'tcl' in license
More information about the pypy-commit
mailing list