MCPcopy Create free account
hub / github.com/numpy/numpy / concat_license_files

Class concat_license_files

setup.py:151–175  ·  view source on GitHub ↗

Merge LICENSE.txt and LICENSES_bundled.txt for sdist creation Done this way to keep LICENSE.txt in repo as exact BSD 3-clause (see gh-13447). This makes GitHub state correctly how NumPy is licensed.

Source from the content-addressed store, hash-verified

149
150
151class concat_license_files():
152 """Merge LICENSE.txt and LICENSES_bundled.txt for sdist creation
153
154 Done this way to keep LICENSE.txt in repo as exact BSD 3-clause (see
155 gh-13447). This makes GitHub state correctly how NumPy is licensed.
156 """
157 def __init__(self):
158 self.f1 = 'LICENSE.txt'
159 self.f2 = 'LICENSES_bundled.txt'
160
161 def __enter__(self):
162 """Concatenate files and remove LICENSES_bundled.txt"""
163 with open(self.f1) as f1:
164 self.bsd_text = f1.read()
165
166 with open(self.f1, 'a') as f1:
167 with open(self.f2) as f2:
168 self.bundled_text = f2.read()
169 f1.write('\n\n')
170 f1.write(self.bundled_text)
171
172 def __exit__(self, exception_type, exception_value, traceback):
173 """Restore content of both files"""
174 with open(self.f1, 'w') as f:
175 f.write(self.bsd_text)
176
177# Need to inherit from versioneer version of sdist to get the encoded
178# version information.

Callers 1

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected