MCPcopy Create free account
hub / github.com/cztomczak/cefpython / modify_deb_archive

Function modify_deb_archive

src/linux/deb_pkg_deprecated/make-deb.py:229–299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

227 subprocess.call("dpkg-buildpackage -rfakeroot -uc -us", shell=True)
228
229def modify_deb_archive():
230 # CEF branch 1650 doesn't work when the .so files do not reside
231 # in the same directory as the subprocess executable. The symlinks
232 # created in /usr/lib/pymodules/ do not help. After launching
233 # CEF and webpage being displayed, the CEF renderer process
234 # crashes after a moment. The solution is to modify the deb
235 # archive, move the /usr/lib/pyshared/.../*.so libraries to
236 # the /usr/share/pyshared/.../ directory. Also some files with
237 # hardcoded paths to /usr/lub/pyshared/ need to be modified
238 # (eg. DEBIAN/md5sums, python-support/python-cefpython3.public).
239 log("Modifying the deb archive")
240
241 # Paths
242 deb_archive_name = "python-%s_%s-1_%s.deb" \
243 % (PACKAGE_NAME, VERSION, ARCHITECTURE)
244 deb_archive_dir = INSTALLER+"/deb_archive"
245
246 # Move the deb archive to the deb_archive/ directory
247 log("Moving the deb archive")
248 os.system("mkdir %s" % deb_archive_dir)
249 os.system("mv %s %s" % (DEB_DIST+"/"+deb_archive_name,\
250 deb_archive_dir+"/"+deb_archive_name))
251
252 # Remove the deb_dist/ directory
253 os.system("rm -rf %s" % DEB_DIST)
254
255 # Extract the deb archive
256 log("Extracting the deb archive")
257 os.chdir(deb_archive_dir)
258 # Extract the usr/ directory
259 os.system("dpkg-deb -x %s ." % deb_archive_name)
260 # Extract the DEBIAN/ directory
261 os.system("dpkg-deb -e %s" % deb_archive_name)
262
263 # Remove the deb archive that was extracted
264 os.system("rm %s" % deb_archive_name)
265
266 # Move the .so files from the ./usr/lib/pyshared/.../ directory
267 # to the ./usr/share/pyshared/.../ directory. Also remove the
268 # ./usr/lib/ directory.
269 log("Moving the .so libraries")
270 lib_pyshared = "./usr/lib/pyshared/%s/%s" \
271 % (PYTHON_NAME, PACKAGE_NAME)
272 share_pyshared = "./usr/share/pyshared/%s" % PACKAGE_NAME
273 os.system("mv %s/*.so %s/" % (lib_pyshared, share_pyshared))
274 os.system("rm -rf ./usr/lib/")
275
276 # Modify also the paths in some text files.
277 # The paths do not start with "/" on purpose. In the md5sums
278 # file the paths are relative. In the python-cefpython3.public
279 # file paths are absolute.
280 log("Modifying paths in the text files")
281 old_path = "usr/lib/pyshared/%s/%s/" % (PYTHON_NAME, PACKAGE_NAME)
282 new_path = "usr/share/pyshared/%s/" % PACKAGE_NAME
283 md5sums_file = "./DEBIAN/md5sums"
284 cefpython3_public_file = "./usr/share/python-support/python-%s.public" \
285 % PACKAGE_NAME
286 old_md5sum = subprocess.check_output("md5sum %s | cut -c 1-32" \

Callers 1

mainFunction · 0.85

Calls 2

replace_in_fileFunction · 0.85
logFunction · 0.70

Tested by

no test coverage detected