def modify_deb_archive():
    # CEF branch 1650 doesn't work when the .so files do not reside
    # in the same directory as the subprocess executable. The symlinks
    # created in /usr/lib/pymodules/ do not help. After launching
    # CEF and webpage being displayed, the CEF renderer process
    # crashes after a moment. The solution is to modify the deb
    # archive, move the /usr/lib/pyshared/.../*.so libraries to
    # the /usr/share/pyshared/.../ directory. Also some files with
    # hardcoded paths to /usr/lub/pyshared/ need to be modified
    # (eg. DEBIAN/md5sums, python-support/python-cefpython3.public).
    log("Modifying the deb archive")

    # Paths
    deb_archive_name = "python-%s_%s-1_%s.deb" \
            % (PACKAGE_NAME, VERSION, ARCHITECTURE)
    deb_archive_dir = INSTALLER+"/deb_archive"

    # Move the deb archive to the deb_archive/ directory
    log("Moving the deb archive")
    os.system("mkdir %s" % deb_archive_dir)
    os.system("mv %s %s" % (DEB_DIST+"/"+deb_archive_name,\
            deb_archive_dir+"/"+deb_archive_name))

    # Remove the deb_dist/ directory
    os.system("rm -rf %s" % DEB_DIST)

    # Extract the deb archive
    log("Extracting the deb archive")
    os.chdir(deb_archive_dir)
    # Extract the usr/ directory
    os.system("dpkg-deb -x %s ." % deb_archive_name)
    # Extract the DEBIAN/ directory
    os.system("dpkg-deb -e %s" % deb_archive_name)

    # Remove the deb archive that was extracted
    os.system("rm %s" % deb_archive_name)

    # Move the .so files from the ./usr/lib/pyshared/.../ directory
    # to the ./usr/share/pyshared/.../ directory. Also remove the
    # ./usr/lib/ directory.
    log("Moving the .so libraries")
    lib_pyshared = "./usr/lib/pyshared/%s/%s" \
            % (PYTHON_NAME, PACKAGE_NAME)
    share_pyshared = "./usr/share/pyshared/%s" % PACKAGE_NAME
    os.system("mv %s/*.so %s/" % (lib_pyshared, share_pyshared))
    os.system("rm -rf ./usr/lib/")

    # Modify also the paths in some text files.
    # The paths do not start with "/" on purpose. In the md5sums
    # file the paths are relative. In the python-cefpython3.public
    # file paths are absolute.
    log("Modifying paths in the text files")
    old_path = "usr/lib/pyshared/%s/%s/" % (PYTHON_NAME, PACKAGE_NAME)
    new_path = "usr/share/pyshared/%s/" % PACKAGE_NAME
    md5sums_file = "./DEBIAN/md5sums"
    cefpython3_public_file = "./usr/share/python-support/python-%s.public" \
            % PACKAGE_NAME
    old_md5sum = subprocess.check_output("md5sum %s | cut -c 1-32" \
            % cefpython3_public_file, shell=True).strip()
    # Modify paths in the text files
    replace_in_file(md5sums_file, old_path, new_path)
    replace_in_file(cefpython3_public_file, old_path, new_path)
    # Correct md5 sum for the python-cefpython3.public file
    new_md5sum = subprocess.check_output("md5sum %s | cut -c 1-32" \
            % cefpython3_public_file, shell=True).strip()
    replace_in_file(md5sums_file, old_md5sum, new_md5sum)

    # Create deb archive from the modified ./DEBIAN/ and
    # ./usr/ directories.
    log("Creating deb archive from the modified files")
    os.system("fakeroot dpkg-deb -b . ./%s" % deb_archive_name)
dataset/ETHPy150Open cztomczak/cefpython/cefpython/cef3/linux/installer/make-deb.py/modify_deb_archive/original