Ejemplo n.º 1
0
    def install(self):
        arch = list(self.filtered_archs)[0]
        build_dir = self.get_build_dir(arch.arch)
        os.chdir(build_dir)

        # manually create expected directory in build directory
        scripts_dir = join("build", "scripts-3.8")
        if not os.path.exists(scripts_dir):
            os.makedirs(scripts_dir)

        hostpython = sh.Command(self.ctx.hostpython)
        build_env = arch.get_env()
        dest_dir = join(self.ctx.dist_dir, "root", "python3")
        build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.8',
                                       'site-packages')
        shprint(hostpython, "setup.py", "build_ext", _env=build_env)
        shprint(hostpython,
                "setup.py",
                "install",
                "--prefix",
                dest_dir,
                _env=build_env)

        # hack: copy _cffi_backend.so from hostpython
        so_file = "_cffi_backend.cpython-38-darwin.so"
        egg_name = "cffi-1.14.3-py3.8-macosx-10.15-x86_64.egg"  # harded - needs to change
        dest_dir = join(self.ctx.dist_dir, "root", "python3", "lib",
                        "python3.8", "site-packages", egg_name)
        dest_dir_main = join(self.ctx.dist_dir, "root", "python3", "lib",
                             "python3.8", "site-packages")

        src_dir = join(self.ctx.dist_dir, "hostpython3", "lib", "python3.8",
                       "site-packages", egg_name)
        sh.cp(join(src_dir, so_file), join(dest_dir, so_file))
        sh.cp(join(src_dir, so_file), join(dest_dir_main, so_file))
Ejemplo n.º 2
0
 def biglink(self):
     dirs = []
     for root, dirnames, filenames in os.walk(self.build_dir):
         if fnmatch.filter(filenames, "*.so.libs"):
             dirs.append(root)
     cmd = sh.Command(join(self.ctx.root_dir, "tools", "biglink"))
     shprint(cmd, join(self.build_dir, "libpil.a"), *dirs)
Ejemplo n.º 3
0
 def install(self):
     arch = list(self.filtered_archs)[0]
     build_env = self.get_build_env()
     build_subdir = self.get_build_subdir(arch.arch)
     build_env["PATH"] = os.environ["PATH"]
     shprint(sh.make,
             self.ctx.concurrent_make,
             "-C",
             build_subdir,
             "install",
             _env=build_env)
     shutil.copy(join(self.ctx.dist_dir, "hostpython3", "bin", "python3"),
                 join(self.ctx.dist_dir, "hostpython3", "bin", "python"))
     """
     I don't like this kind of "patches".
     sysconfig was overriding our cflags and extensions were failing to build.
     This hack resets the cflags provided by sysconfig.
     """
     with open(
             join(self.ctx.dist_dir, "hostpython3", "lib", "python3.8",
                  "distutils", "sysconfig.py"), 'r') as sysconfigfile:
         lines = sysconfigfile.readlines()
     lines[192] = '        cflags = ""\n'
     with open(
             join(self.ctx.dist_dir, "hostpython3", "lib", "python3.8",
                  "distutils", "sysconfig.py"), 'w') as sysconfigfile:
         sysconfigfile.writelines(lines)
Ejemplo n.º 4
0
 def build_arch(self, arch):
     env = arch.get_env()
     shprint(sh.xcodebuild, self.ctx.concurrent_xcodebuild,
             "ONLY_ACTIVE_ARCH=NO", "ARCHS={}".format(arch.arch),
             "BITCODE_GENERATION_MODE=bitcode", "CC={}".format(env['CC']),
             "-sdk", arch.sdk, "-project", "Xcode-iOS/SDL/SDL.xcodeproj",
             "-target", "libSDL-iOS", "-configuration", "Release")
Ejemplo n.º 5
0
 def install(self):
     arch = list(self.filtered_archs)[0]
     build_dir = self.get_build_dir(arch.arch)
     os.chdir(build_dir)
     hostpython = sh.Command(self.ctx.hostpython)
     build_env = arch.get_env()
     dest_dir = join(self.ctx.dist_dir, "root", "python")
     build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.7',
                                    'site-packages')
     cmd = sh.Command("sed")
     shprint(cmd, "-i", "", "s/,.*Feature//g", "./setup.py", _env=build_env)
     shprint(cmd,
             "-i",
             "",
             "s/setuptools/distutils.core/g",
             "./setup.py",
             _env=build_env)
     shprint(cmd,
             "-i",
             "",
             "/^speedups = Feature/,/^)$/s/.*//g",
             "./setup.py",
             _env=build_env)
     shprint(cmd,
             "-i",
             "",
             "s/features\['speedups'\].*=.*speedups/pass/g",
             "./setup.py",
             _env=build_env)  # noqa: W605
     shprint(hostpython,
             "setup.py",
             "install",
             "--prefix",
             dest_dir,
             _env=build_env)
Ejemplo n.º 6
0
 def postbuild_arch(self, arch):
     # include _sqlite module to .a
     py_arch = arch.arch
     if py_arch == "armv7":
         py_arch = "arm"
     elif py_arch == "arm64":
         py_arch = "aarch64"
     tmp_folder = "temp.ios-{}-3.8{}".format(py_arch, self.build_dir)
     build_env = self.get_build_env(arch)
     for o_file in [
             "cache.o",
             "cursor.o",
             "module.o",
             "row.o",
             "util.o",
             "connection.o",
             "microprotocols.o",
             "prepare_protocol.o",
             "statement.o",
     ]:
         shprint(
             sh.Command(build_env['AR']), "-r",
             "{}/{}".format(self.build_dir, self.library),
             "{}/build/{}/Modules/_sqlite/{}".format(
                 self.build_dir, tmp_folder, o_file))
     print("Added _sqlite to archive")
Ejemplo n.º 7
0
 def build_arch(self, arch):
     shprint(
         sh.xcodebuild, self.ctx.concurrent_xcodebuild,
         "ONLY_ACTIVE_ARCH=NO", "ARCHS={}".format(arch.arch),
         "BITCODE_GENERATION_MODE=bitcode", "HEADER_SEARCH_PATHS={}".format(
             join(self.ctx.include_dir, "common", "sdl2")), "-sdk",
         arch.sdk, "-project", "Xcode-iOS/SDL_image.xcodeproj", "-target",
         "libSDL_image-iOS", "-configuration", "Release")
Ejemplo n.º 8
0
 def install(self):
     arch = list(self.filtered_archs)[0]
     build_dir = self.get_build_dir(arch.arch)
     hostpython = sh.Command(self.ctx.hostpython)
     build_env = arch.get_env()
     dest_dir = join(self.ctx.dist_dir, "root", "python3")
     build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.7', 'site-packages')
     with cd(build_dir):
         shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
Ejemplo n.º 9
0
    def install(self):
        arch = self.filtered_archs[0]
        build_dir = self.get_build_dir(arch.arch)
        hostpython = sh.Command(self.ctx.hostpython)

        with python_path(self.ctx.site_packages_dir):
            with cd(build_dir):
                shprint(hostpython, "setup.py", "install",
                        f"--prefix={self.ctx.python_prefix}")
Ejemplo n.º 10
0
 def build_arch(self, arch):
     build_env = self.get_build_env(arch)
     configure = sh.Command(join(self.build_dir, "configure"))
     py_arch = arch.arch
     if py_arch == "armv7":
         py_arch = "arm"
     elif py_arch == "arm64":
         py_arch = "aarch64"
     prefix = join(self.ctx.dist_dir, "root", "python3")
     shprint(configure,
             "CC={}".format(build_env["CC"]),
             "LD={}".format(build_env["LD"]),
             "CFLAGS={}".format(build_env["CFLAGS"]),
             "LDFLAGS={} -undefined dynamic_lookup".format(
                 build_env["LDFLAGS"]),
             "ac_cv_file__dev_ptmx=yes",
             "ac_cv_file__dev_ptc=no",
             "ac_cv_little_endian_double=yes",
             "ac_cv_func_memrchr=no",
             "ac_cv_func_getentropy=no",
             "ac_cv_func_getresuid=no",
             "ac_cv_func_getresgid=no",
             "ac_cv_func_setresgid=no",
             "ac_cv_func_setresuid=no",
             "ac_cv_func_plock=no",
             "ac_cv_func_dup3=no",
             "ac_cv_func_pipe2=no",
             "ac_cv_func_preadv=no",
             "ac_cv_func_pwritev=no",
             "ac_cv_func_preadv2=no",
             "ac_cv_func_pwritev2=no",
             "ac_cv_func_mkfifoat=no",
             "ac_cv_func_mknodat=no",
             "ac_cv_func_posix_fadvise=no",
             "ac_cv_func_posix_fallocate=no",
             "ac_cv_func_sigwaitinfo=no",
             "ac_cv_func_sigtimedwait=no",
             "ac_cv_func_clock_settime=no",
             "ac_cv_func_pthread_getcpuclockid=no",
             "ac_cv_func_sched_setscheduler=no",
             "ac_cv_func_sched_setparam=no",
             "ac_cv_func_clock_gettime=no",
             "--host={}-apple-ios".format(py_arch),
             "--build=x86_64-apple-darwin",
             "--prefix={}".format(prefix),
             "--without-ensurepip",
             "--with-system-ffi",
             "--enable-ipv6",
             "PYTHON_FOR_BUILD=_PYTHON_PROJECT_BASE=$(abs_builddir) \
                 _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) \
                 PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib\
                 _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH)\
                 {}".format(sh.Command(self.ctx.hostpython)),
             _env=build_env)
     self.apply_patch("ctypes_duplicate.patch")
     shprint(sh.make, self.ctx.concurrent_make)
Ejemplo n.º 11
0
 def prebuild_arch(self, arch):
     if self.has_marker("patched"):
         return
     shprint(sh.sed, "-i.bak",
             "s/-miphoneos-version-min=5.1.1/-miphoneos-version-min=9.0/g",
             "generate-darwin-source-and-headers.py")
     self.apply_patch("fix-win32-unreferenced-symbol.patch")
     self.apply_patch(
         "generate-darwin-source-and-headers-python3-items.patch")
     self.set_marker("patched")
Ejemplo n.º 12
0
 def build_arch(self, arch):
     self.apply_patch('pil_setup.patch')
     build_env = self.get_pil_env(arch)
     # build_dir = self.get_build_dir(arch.arch)
     hostpython = sh.Command(self.ctx.hostpython)
     # build_env["PYTHONHOME"] = hostpython
     # first try to generate .h
     shprint(hostpython, "setup.py", "build_ext", "-g",
             _env=build_env)
     self.biglink()
Ejemplo n.º 13
0
 def build_arch(self, arch):
     build_env = self.get_pil_env(arch)
     hostpython3 = sh.Command(self.ctx.hostpython)
     shprint(hostpython3,
             "setup.py",
             "build_ext",
             "--disable-tiff",
             "--disable-webp",
             "-g",
             _env=build_env)
     self.biglink()
Ejemplo n.º 14
0
 def install(self):
     arch = list(self.filtered_archs)[0]
     build_env = self.get_build_env(arch)
     build_dir = self.get_build_dir(arch.arch)
     shprint(sh.make, self.ctx.concurrent_make,
             "-C", build_dir,
             "install",
             "prefix={}".format(join(self.ctx.dist_dir, "root", "python3")),
             _env=build_env)
     self.reduce_python()
     self.install_mock_modules()
Ejemplo n.º 15
0
 def install(self):
     arch = list(self.filtered_archs)[0]
     build_dir = self.get_build_dir(arch.arch)
     os.chdir(build_dir)
     hostpython = sh.Command(self.ctx.hostpython)
     build_env = self.get_pil_env(arch)
     dest_dir = join(self.ctx.dist_dir, "root", "python")
     build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.7', 'site-packages')
     shprint(hostpython, "-m", "easy_install",
             "--prefix", dest_dir, "-Z", "./",
             _env=build_env)
Ejemplo n.º 16
0
 def build_arch(self, arch):
     # XCode-iOS have shipped freetype that don't work with i386
     # ./configure require too much things to setup it correcly.
     # so build by hand.
     build_env = arch.get_env()
     cc = sh.Command(build_env["CC"])
     output = join(self.build_dir, "SDL_ttf.o")
     args = shlex.split(build_env["CFLAGS"])
     args += ["-c", "-o", output, "SDL_ttf.c"]
     shprint(cc, *args)
     shprint(sh.ar, "-q", join(self.build_dir, "libSDL2_ttf.a"), output)
Ejemplo n.º 17
0
 def postbuild_arch(self, arch):
     py_arch = arch.arch
     if py_arch == "arm64":
         py_arch = "x86_64"
     build_dir = self.get_build_dir(arch.arch)
     build_env = self.get_recipe_env(arch)
     tmp_folder = 'build/temp.macosx-10.15-{}-3.8/build/temp.macosx-10.15-{}-3.8'.format(
         py_arch, py_arch)
     shprint(sh.Command(build_env['AR']), "-q",
             "{}/{}".format(self.build_dir, self.library),
             "{}/{}/_libsecp256k1.o".format(self.build_dir, tmp_folder))
Ejemplo n.º 18
0
 def build_arch(self, arch):
     # endian.h is in /usr/include/machine/ (Since MacOs Mojave?)
     # header is needed by libvorbis, so We're adding that folder
     # to HEADER_SEARCH_PATHS
     shprint(
         sh.xcodebuild, self.ctx.concurrent_xcodebuild,
         "ONLY_ACTIVE_ARCH=NO", "ARCHS={}".format(arch.arch),
         "HEADER_SEARCH_PATHS=$HEADER_SEARCH_PATHS /usr/include/machine {} "
         .format(" ".join(arch.include_dirs)), "-sdk", arch.sdk, "-project",
         "Xcode-iOS/SDL_mixer.xcodeproj", "-target", "libSDL_mixer-iOS",
         "-configuration", "Release")
Ejemplo n.º 19
0
 def install(self):
     arch = list(self.filtered_archs)[0]
     build_dir = self.get_build_dir(arch.arch)
     os.chdir(build_dir)
     hostpython = sh.Command(self.ctx.hostpython)
     build_env = arch.get_env()
     dest_dir = join(self.ctx.dist_dir, "root", "python")
     build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.7', 'site-packages')
     cmd = sh.Command("sed")
     shprint(cmd, "-i", "", "s/setuptools/distutils.core/g", "./setup.py", _env=build_env)
     shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
Ejemplo n.º 20
0
 def install(self):
     arch = list(self.filtered_archs)[0]
     build_env = self.get_build_env()
     build_subdir = self.get_build_subdir(arch.arch)
     build_env["PATH"] = os.environ["PATH"]
     shprint(sh.make, self.ctx.concurrent_make,
             "-C", build_subdir,
             "install",
             _env=build_env)
     shutil.copy(
         join(self.ctx.dist_dir, "hostpython3", "bin", "python3"),
         join(self.ctx.dist_dir, "hostpython3", "bin", "python"))
Ejemplo n.º 21
0
 def build_arch(self, arch):
     build_env = arch.get_env()
     self.apply_patch('hash_SHA2_template.c.patch',
                      target_dir=self.build_dir + '/src')
     configure = sh.Command(join(self.build_dir, "configure"))
     shprint(configure, "CC={}".format(build_env["CC"]), "LD={}".format(
         build_env["LD"]), "CFLAGS={}".format(build_env["CFLAGS"]),
             "LDFLAGS={} -Wno-error ".format(build_env["LDFLAGS"]),
             "--prefix=/", "--host={}".format(arch),
             "ac_cv_func_malloc_0_nonnull=yes",
             "ac_cv_func_realloc_0_nonnull=yes")
     super(PycryptoRecipe, self).build_arch(arch)
Ejemplo n.º 22
0
    def reduce_python(self):
        logger.info("Reduce python")
        logger.info("Remove files unlikely to be used")
        with cd(join(self.ctx.dist_dir, "root", "python3")):
            sh.rm("-rf", "bin", "share")
        # platform binaries and configuration
        with cd(
                join(self.ctx.dist_dir, "root", "python3", "lib", "python3.8",
                     "config-3.8-darwin")):
            sh.rm(
                "libpython3.8.a",
                "python.o",
                "config.c.in",
                "makesetup",
                "install-sh",
            )

        # cleanup pkgconfig and compiled lib
        with cd(join(self.ctx.dist_dir, "root", "python3", "lib")):
            sh.rm("-rf", "pkgconfig", "libpython3.8.a")

        # cleanup python libraries
        with cd(join(self.ctx.dist_dir, "root", "python3", "lib",
                     "python3.8")):
            sh.rm("-rf", "wsgiref", "curses", "idlelib", "lib2to3",
                  "ensurepip", "turtledemo", "lib-dynload", "venv",
                  "pydoc_data")
            sh.find(".", "-path", "*/test*/*", "-delete")
            sh.find(".", "-name", "*.exe", "-type", "f", "-delete")
            sh.find(".", "-name", "test*", "-type", "d", "-delete")
            sh.find(".", "-iname", "*.pyc", "-delete")
            sh.find(".", "-path", "*/__pycache__/*", "-delete")
            sh.find(".", "-name", "__pycache__", "-type", "d", "-delete")

            # now precompile to Python bytecode
            hostpython = sh.Command(self.ctx.hostpython)
            shprint(hostpython, "-m", "compileall", "-f", "-b")
            # sh.find(".", "-iname", "*.py", "-delete")

            # some pycache are recreated after compileall
            sh.find(".", "-path", "*/__pycache__/*", "-delete")
            sh.find(".", "-name", "__pycache__", "-type", "d", "-delete")

            # create the lib zip
            logger.info("Create a python3.8.zip")
            sh.mv("config-3.8-darwin", "..")
            sh.mv("site-packages", "..")
            sh.zip("-r", "../python38.zip", sh.glob("*"))
            sh.rm("-rf", sh.glob("*"))
            sh.mv("../config-3.8-darwin", ".")
            sh.mv("../site-packages", ".")
Ejemplo n.º 23
0
 def build_arch(self, arch):
     super(LibZBarRecipe, self).build_arch(arch)
     build_env = arch.get_env()
     build_env["CFLAGS"] = " ".join([
         "-I{}".format(
             join(self.ctx.dist_dir, "build", "libiconv", arch.arch)) +
         " -arch {}".format(arch.arch), build_env['CFLAGS']
     ])
     shprint(sh.Command('autoreconf'), '-vif')
     shprint(
         sh.Command('./configure'),
         "CC={}".format(build_env["CC"]),
         "LD={}".format(build_env["LD"]),
         "CFLAGS={}".format(build_env["CFLAGS"]),
         "LDFLAGS={}".format(build_env["LDFLAGS"]),
         "--host={}".format(arch.triple),
         '--target={}'.format(arch.triple),
         # Python bindings are compiled in a separated recipe
         '--with-python=no',
         '--with-gtk=no',
         '--with-qt=no',
         '--with-x=no',
         '--with-jpeg=no',
         '--with-imagemagick=no',
         '--enable-pthread=no',
         '--enable-video=no',
         "--disable-shared",
         _env=build_env)
     shprint(sh.make, 'clean')
     shprint(sh.make, _env=build_env)
Ejemplo n.º 24
0
 def install(self):
     arch = list(self.filtered_archs)[0]
     build_dir = self.get_build_dir(arch.arch)
     os.chdir(build_dir)
     hostpython = sh.Command(self.ctx.hostpython)
     build_env = arch.get_env()
     dest_dir = join(self.ctx.dist_dir, "root", "python3")
     build_env['PYTHONPATH'] = self.ctx.site_packages_dir
     shprint(hostpython,
             "setup.py",
             "install",
             "--prefix",
             dest_dir,
             _env=build_env)
Ejemplo n.º 25
0
 def install(self):
     arch = list(self.filtered_archs)[0]
     build_dir = self.get_build_dir(arch.arch)
     build_env = self.get_netifaces_env(arch)
     hostpython = sh.Command(self.ctx.hostpython)
     with cd(build_dir):
         shprint(
             hostpython,
             "setup.py",
             "install",
             "--prefix",
             self.dest_dir(),
             _env=build_env,
         )
Ejemplo n.º 26
0
    def install(self):
        """
        This method simply builds the command line call for calling
        kivent_core/modules/core/setup.py

        This constructs the equivalent of the command
        "$python setup.py build_ext install"
        only with the environment variables altered for each different architecture
        The appropriate version of kivy also needs to be added to the path, and this
        differs for each architecture (i386, x86_64, armv7, etc)

        Note: This method is called by build_all() in toolchain.py

        """
        arch = list(self.filtered_archs)[0]

        build_dir = self.get_build_dir(arch.arch, sub=True)
        logger.info("Building kivent_core {} in {}".format(
            arch.arch, build_dir))
        chdir(build_dir)
        hostpython = sh.Command(self.ctx.hostpython)

        # Get the appropriate environment for this recipe (including CYTHONPATH)
        # build_env = arch.get_env()
        build_env = self.get_recipe_env(arch)

        dest_dir = join(self.ctx.dist_dir, "root", "python")
        build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python3.7',
                                       'site-packages')

        # Add Architecture specific kivy path for 'import kivy' to PYTHONPATH
        arch_kivy_path = self.get_recipe('kivy',
                                         self.ctx).get_build_dir(arch.arch)
        build_env['PYTHONPATH'] = join(build_env['PYTHONPATH'], ':',
                                       arch_kivy_path)

        # Make sure you call kivent_core/modules/core/setup.py
        subdir_path = self.get_build_dir(str(arch), sub=True)
        setup_path = join(subdir_path, "setup.py")

        # Print out directories for sanity check
        logger.info("ENVS", build_env)
        logger.info("ROOT", self.ctx.root_dir)
        logger.info("BUILD", self.ctx.build_dir)
        logger.info("INCLUDE", self.ctx.include_dir)
        logger.info("DISTDIR", self.ctx.dist_dir)
        logger.info("ARCH KIVY LOC",
                    self.get_recipe('kivy', self.ctx).get_build_dir(arch.arch))

        shprint(hostpython, setup_path, "build_ext", "install", _env=build_env)
Ejemplo n.º 27
0
 def postbuild_arch(self, arch):
     py_arch = arch.arch
     if py_arch == "arm64":
         py_arch = "x86_64"
     build_dir = self.get_build_dir(arch.arch)
     build_env = self.get_recipe_env(arch)
     tmp_folder = 'build/temp.macosx-10.15-{}-3.8/build/temp.macosx-10.15-{}-3.8'.format(
         py_arch, py_arch)
     for o_file in [
             "_openssl.o",
             "_padding.o",
     ]:
         shprint(sh.Command(build_env['AR']), "-q",
                 "{}/{}".format(self.build_dir, self.library),
                 "{}/{}/{}".format(self.build_dir, tmp_folder, o_file))
Ejemplo n.º 28
0
 def build_arch(self, arch):
     build_env = self.get_recipe_env(arch)
     hostpython3 = sh.Command(self.ctx.hostpython)
     shprint(
         hostpython3,
         "setup.py",
         "build_ext",
         "--disable-tiff",
         "--disable-webp",
         "--disable-jpeg2000",
         "--disable-lcms",
         "--disable-platform-guessing",
         "-g",
         _env=build_env,
     )
     self.biglink()
Ejemplo n.º 29
0
 def build_x86_64(self):
     build_env = self.get_build_env()
     configure = sh.Command(join(self.build_dir, "configure"))
     arch = self.filtered_archs[0]
     build_subdir = self.get_build_subdir(arch.arch)
     os.makedirs(build_subdir, exist_ok=True)
     with cd(build_subdir):
         shprint(configure,
                 "--prefix={}".format(join(self.ctx.dist_dir,
                                           "hostpython3")),
                 "--with-openssl={}".format(
                     join(self.ctx.dist_dir, 'hostopenssl')),
                 _env=build_env)
     shprint(sh.make,
             "-C",
             build_subdir,
             self.ctx.concurrent_make,
             _env=build_env)
Ejemplo n.º 30
0
 def prebuild_arch(self, arch):
     hostpython = sh.Command(self.ctx.hostpython)
     sh.curl("-O", "https://bootstrap.pypa.io/ez_setup.py")
     shprint(hostpython, "./ez_setup.py")
     # Extract setuptools egg and remove .pth files. Otherwise subsequent
     # python package installations using setuptools will raise exceptions.
     # Setuptools version 28.3.0
     site_packages_path = join(self.ctx.dist_dir, 'hostpython3', 'lib',
                               'python3.8', 'site-packages')
     os.chdir(site_packages_path)
     with open('setuptools.pth', 'r') as f:
         setuptools_egg_path = f.read().strip('./').strip('\n')
         unzip = sh.Command('unzip')
         shprint(unzip, '-o', setuptools_egg_path)
     os.remove(setuptools_egg_path)
     os.remove('setuptools.pth')
     os.remove('easy-install.pth')
     shutil.rmtree('EGG-INFO')