Problem with python cx_Freeze egg

im trying to create an executable (for 32-bit xp windows) from a python script (which uses a lot of eggs)

i reviewed py2exe (0.6.9), PyInstaller (1.4) and cx_Freeze (4.1.2)

py2exe does not like eggs for breakfast

PyInstaller does not like python 2.6 for lunch )

so I went with cx_Freeze ( supposedly supported eggs smoothly from 4.0 ). but for some reason it doesn’t.

What parameters can I pass so that the files inside the egg are recognized?

+3
source share
2 answers

package: [dependencies,] setup.py. py2exe py2Exe Docs, script, : python unpackEgg.py eggsmodule:

    import os
    import pkg_resources
    import sys
    from setuptools.archive_util import unpack_archive

    def unpackEgg(modulo):
        eggs = pkg_resources.require(modulo)
        for egg in eggs:
            if os.path.isdir(egg.location):
                sys.path.insert(0, egg.location)
                continue
            unpack_archive(egg.location, ".")
        eggpacks = set()
        eggspth = open("./eggs.pth", "w")
        for egg in eggs:
            print egg
            eggspth.write(os.path.basename(egg.location))
            eggspth.write("\n")
            eggpacks.update(egg.get_metadata_lines("top_level.txt"))
        eggspth.close()

        eggpacks.clear()


    if __name__ == '__main__':
    unpackEgg(sys.argv[1])
+2

PyInstaller 2.6, , .

0

Source: https://habr.com/ru/post/1741003/


All Articles