コード例 #1
0
 def sources(cls, interpreter):
     for src in super(Python2, cls).sources(interpreter):
         yield src
     # install files needed to run site.py
     for req in cls.modules():
         yield PathRefToDest(Path(interpreter.system_stdlib) / "{}.py".format(req), dest=cls.to_stdlib)
         comp = Path(interpreter.system_stdlib) / "{}.pyc".format(req)
         if comp.exists():
             yield PathRefToDest(comp, dest=cls.to_stdlib)
コード例 #2
0
ファイル: cpython2.py プロジェクト: nhutphong/djangoblog
    def sources(cls, interpreter):
        yield from super().sources(interpreter)
        py27_dll = Path(interpreter.system_executable).parent / "python27.dll"
        if py27_dll.exists(
        ):  # this might be global in the Windows folder in which case it's alright to be missing
            yield PathRefToDest(py27_dll, dest=cls.to_bin)

        libs = Path(interpreter.system_prefix) / "libs"
        if libs.exists():
            yield PathRefToDest(libs, dest=lambda self, s: self.dest / s.name)
コード例 #3
0
ファイル: python2.py プロジェクト: Walnuss110/RabbitMQ
 def sources(cls, interpreter):
     for src in super(Python2, cls).sources(interpreter):
         yield src
     # install files needed to run site.py
     for req in cls.modules():
         stdlib_path = interpreter.stdlib_path("{}.py".format(req))
         yield PathRefToDest(stdlib_path, dest=cls.to_stdlib)
         comp = stdlib_path.parent / "{}.pyc".format(req)
         if comp.exists():
             yield PathRefToDest(comp, dest=cls.to_stdlib)
コード例 #4
0
ファイル: mac_os.py プロジェクト: Walnuss110/RabbitMQ
    def sources(cls, interpreter):
        for src in super(CPython2macOsFramework, cls).sources(interpreter):
            yield src

        # landmark for exec_prefix
        name = "lib-dynload"
        yield PathRefToDest(interpreter.stdlib_path(name), dest=cls.to_stdlib)

        # this must symlink to the host prefix Python
        marker = Path(interpreter.prefix) / "Python"
        ref = PathRefToDest(marker, dest=lambda self, _: self.dest / ".Python", must_symlink=True)
        yield ref
コード例 #5
0
ファイル: python2.py プロジェクト: timgates42/virtualenv
 def sources(cls, interpreter):
     yield from super().sources(interpreter)
     # install files needed to run site.py, either from stdlib or stdlib_platform, at least pyc, but both if exists
     # if neither exists return the module file to trigger failure
     mappings, needs_py_module = (
         cls.mappings(interpreter),
         cls.needs_stdlib_py_module(),
     )
     for req in cls.modules():
         module_file, to_module, module_exists = cls.from_stdlib(mappings, f"{req}.py")
         compiled_file, to_compiled, compiled_exists = cls.from_stdlib(mappings, f"{req}.pyc")
         if needs_py_module or module_exists or not compiled_exists:
             yield PathRefToDest(module_file, dest=to_module)
         if compiled_exists:
             yield PathRefToDest(compiled_file, dest=to_compiled)
コード例 #6
0
 def sources(cls, interpreter):
     for src in super(PyPy2, cls).sources(interpreter):
         yield src
     # include folder needed on Python 2 as we don't have pyenv.cfg
     host_include_marker = cls.host_include_marker(interpreter)
     if host_include_marker.exists():
         yield PathRefToDest(host_include_marker.parent, dest=lambda self, _: self.include)
コード例 #7
0
 def sources(cls, interpreter):
     for src in super(Pypy2Windows, cls).sources(interpreter):
         yield src
     yield PathRefToDest(
         Path(interpreter.system_prefix) / "libs",
         dest=lambda self, s: self.dest / s.name,
     )
コード例 #8
0
ファイル: cpython3.py プロジェクト: Bhanu-1310/Swachh-Bharat
 def include_dll_and_pyd(cls, interpreter):
     dll_folder = Path(interpreter.system_prefix) / "DLLs"
     host_exe_folder = Path(interpreter.system_executable).parent
     for folder in [host_exe_folder, dll_folder]:
         for file in folder.iterdir():
             if file.suffix in (".pyd", ".dll"):
                 yield PathRefToDest(file, dest=cls.to_dll_and_pyd)
コード例 #9
0
 def sources(cls, interpreter):
     for src in super(PyPy3Posix, cls).sources(interpreter):
         yield src
     host_lib = Path(interpreter.system_prefix) / "lib"
     if host_lib.exists() and host_lib.is_dir():
         for path in host_lib.iterdir():
             yield PathRefToDest(path, dest=cls.to_lib)
コード例 #10
0
 def sources(cls, interpreter):
     for src in super(CPython2Posix, cls).sources(interpreter):
         yield src
     # landmark for exec_prefix
     exec_marker_file, to_path, _ = cls.from_stdlib(
         cls.mappings(interpreter), "lib-dynload")
     yield PathRefToDest(exec_marker_file, dest=to_path)
コード例 #11
0
ファイル: mac_os.py プロジェクト: ALEHACKsp/BasicPythonMenu
 def sources(cls, interpreter):
     for src in super(CPythonmacOsFramework, cls).sources(interpreter):
         yield src
     # add a symlink to the host python image
     exe = cls.image_ref(interpreter)
     ref = PathRefToDest(exe, dest=lambda self, _: self.dest / ".Python", must=RefMust.SYMLINK)
     yield ref
コード例 #12
0
ファイル: mac_os.py プロジェクト: UsamaSadiq/virtualenv
 def sources(cls, interpreter):
     for src in super(CPythonmacOsFramework, cls).sources(interpreter):
         yield src
     # add a symlink to the host python image
     ref = PathRefToDest(cls.image_ref(interpreter),
                         dest=lambda self, _: self.dest / ".Python",
                         must_symlink=True)
     yield ref
コード例 #13
0
ファイル: mac_os.py プロジェクト: timgates42/virtualenv
    def sources(cls, interpreter):
        yield from super().sources(interpreter)
        # landmark for exec_prefix
        exec_marker_file, to_path, _ = cls.from_stdlib(
            cls.mappings(interpreter), "lib-dynload")
        yield PathRefToDest(exec_marker_file, dest=to_path)

        # add a copy of the host python image
        exe = Path(interpreter.prefix) / "Python"
        yield PathRefToDest(exe,
                            dest=lambda self, _: self.dest / "Python",
                            must=RefMust.COPY)

        # add a symlink to the Resources dir
        resources = Path(interpreter.prefix) / "Resources"
        yield PathRefToDest(resources,
                            dest=lambda self, _: self.dest / "Resources")
コード例 #14
0
    def sources(cls, interpreter):
        for src in super(PyPy2, cls).sources(interpreter):
            yield src

        host_include_marker = cls.host_include_marker(interpreter)
        if host_include_marker.exists():
            yield PathRefToDest(host_include_marker.parent,
                                dest=lambda self, _: self.include)
コード例 #15
0
ファイル: cpython2.py プロジェクト: nhutphong/djangoblog
 def sources(cls, interpreter):
     yield from super().sources(interpreter)
     # include folder needed on Python 2 as we don't have pyenv.cfg
     host_include_marker = cls.host_include_marker(interpreter)
     if host_include_marker.exists():
         yield PathRefToDest(
             host_include_marker.parent,
             dest=lambda self, _: self.include)  # noqa: U101
コード例 #16
0
ファイル: mac_os.py プロジェクト: nhutphong/djangoblog
    def sources(cls, interpreter):
        yield from super().sources(interpreter)

        # add a symlink to the host python image
        exe = Path(interpreter.prefix) / "Python3"
        yield PathRefToDest(exe,
                            dest=lambda self, _: self.dest / ".Python",
                            must=RefMust.SYMLINK)  # noqa: U101
コード例 #17
0
    def sources(cls, interpreter):
        for src in super(CPython2PosixBase, cls).sources(interpreter):
            yield src

        # check if the makefile exists and if so make it available under the virtual environment
        make_file = Path(interpreter.sysconfig["makefile_filename"])
        if make_file.exists() and str(make_file).startswith(interpreter.prefix):
            under_prefix = make_file.relative_to(Path(interpreter.prefix))
            yield PathRefToDest(make_file, dest=lambda self, s: self.dest / under_prefix)
コード例 #18
0
ファイル: cpython3.py プロジェクト: ofek/virtualenv
    def dll_and_pyd(cls, interpreter):
        folders = [Path(interpreter.system_executable).parent]

        # May be missing on some Python hosts.
        # See https://github.com/pypa/virtualenv/issues/2368
        dll_folder = Path(interpreter.system_prefix) / "DLLs"
        if dll_folder.is_dir():
            folders.append(dll_folder)

        for folder in folders:
            for file in folder.iterdir():
                if file.suffix in (".pyd", ".dll"):
                    yield PathRefToDest(file, cls.to_bin)
コード例 #19
0
 def sources(cls, interpreter):
     for src in super(PyPy3Posix, cls).sources(interpreter):
         yield src
     # Also copy/symlink anything under prefix/lib, which, for "portable"
     # PyPy builds, includes the tk,tcl runtime and a number of shared
     # objects. In distro-specific builds or on conda this should be empty
     # (on PyPy3.8+ it will, like on CPython, hold the stdlib).
     host_lib = Path(interpreter.system_prefix) / "lib"
     stdlib = Path(interpreter.system_stdlib)
     if host_lib.exists() and host_lib.is_dir():
         for path in host_lib.iterdir():
             if stdlib == path:
                 # For PyPy3.8+ the stdlib lives in lib/pypy3.8
                 # We need to avoid creating a symlink to it since that
                 # will defeat the purpose of a virtualenv
                 continue
             yield PathRefToDest(path, dest=cls.to_lib)
コード例 #20
0
ファイル: cpython3.py プロジェクト: ofek/virtualenv
    def python_zip(cls, interpreter):
        """
        "python{VERSION}.zip" contains compiled *.pyc std lib packages, where
        "VERSION" is `py_version_nodot` var from the `sysconfig` module.
        :see: https://docs.python.org/3/using/windows.html#the-embeddable-package
        :see: `discovery.py_info.PythonInfo` class (interpreter).
        :see: `python -m sysconfig` output.

        :note: The embeddable Python distribution for Windows includes
        "python{VERSION}.zip" and "python{VERSION}._pth" files. User can
        move/rename *zip* file and edit `sys.path` by editing *_pth* file.
        Here the `pattern` is used only for the default *zip* file name!
        """
        pattern = "*python{}.zip".format(interpreter.version_nodot)
        matches = fnmatch.filter(interpreter.path, pattern)
        matched_paths = map(Path, matches)
        existing_paths = filter(method("exists"), matched_paths)
        path = next(existing_paths, None)
        if path is not None:
            yield PathRefToDest(path, cls.to_bin)
コード例 #21
0
ファイル: pypy3.py プロジェクト: timgates42/virtualenv
 def sources(cls, interpreter):
     yield from super().sources(interpreter)
     # PyPy >= 3.8 supports a standard prefix installation, where older
     # versions always used a portable/developent style installation.
     # If this is a standard prefix installation, skip the below:
     if interpreter.system_prefix == "/usr":
         return
     # Also copy/symlink anything under prefix/lib, which, for "portable"
     # PyPy builds, includes the tk,tcl runtime and a number of shared
     # objects. In distro-specific builds or on conda this should be empty
     # (on PyPy3.8+ it will, like on CPython, hold the stdlib).
     host_lib = Path(interpreter.system_prefix) / "lib"
     stdlib = Path(interpreter.system_stdlib)
     if host_lib.exists() and host_lib.is_dir():
         for path in host_lib.iterdir():
             if stdlib == path:
                 # For PyPy3.8+ the stdlib lives in lib/pypy3.8
                 # We need to avoid creating a symlink to it since that
                 # will defeat the purpose of a virtualenv
                 continue
             yield PathRefToDest(path, dest=cls.to_lib)
コード例 #22
0
 def sources(cls, interpreter):
     for src in super(PyPy2Posix, cls).sources(interpreter):
         yield src
     host_lib = Path(interpreter.system_prefix) / "lib"
     if host_lib.exists():
         yield PathRefToDest(host_lib, dest=lambda self, _: self.lib)
コード例 #23
0
ファイル: common.py プロジェクト: ALEHACKsp/BasicPythonMenu
 def sources(cls, interpreter):
     for src in super(PyPy, cls).sources(interpreter):
         yield src
     for host in cls._add_shared_libs(interpreter):
         yield PathRefToDest(host, dest=lambda self, s: self.bin_dir / s.name)
コード例 #24
0
 def sources(cls, interpreter):
     yield from super().sources(interpreter)
     yield PathRefToDest(Path(interpreter.system_prefix) / "libs",
                         dest=lambda self, s: self.dest / s.name)
コード例 #25
0
 def sources(cls, interpreter):
     yield from super().sources(interpreter)
     host_lib = Path(interpreter.system_prefix) / "lib"
     if host_lib.exists():
         yield PathRefToDest(host_lib,
                             dest=lambda self, _: self.lib)  # noqa: U101
コード例 #26
0
ファイル: cpython2.py プロジェクト: nhutphong/djangoblog
 def sources(cls, interpreter):
     yield from super().sources(interpreter)
     # landmark for exec_prefix
     exec_marker_file, to_path, _ = cls.from_stdlib(
         cls.mappings(interpreter), "lib-dynload")
     yield PathRefToDest(exec_marker_file, dest=to_path)
コード例 #27
0
 def sources(cls, interpreter):
     for src in super(CPython2Posix, cls).sources(interpreter):
         yield src
     # landmark for exec_prefix
     name = "lib-dynload"
     yield PathRefToDest(interpreter.stdlib_path(name), dest=cls.to_stdlib)
コード例 #28
0
ファイル: common.py プロジェクト: timgates42/virtualenv
 def sources(cls, interpreter):
     yield from cls.executables(interpreter)
     for host in cls._add_shared_libs(interpreter):
         yield PathRefToDest(host,
                             dest=lambda self, s: self.bin_dir / s.name)