晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
| DIR:/opt/cloudlinux/venv/lib64/python3.11/site-packages/virtualenv/create/via_global_ref/ |
| Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/virtualenv/create/via_global_ref/venv.py |
import logging
from copy import copy
from virtualenv.create.via_global_ref.store import handle_store_python
from virtualenv.discovery.py_info import PythonInfo
from virtualenv.util.error import ProcessCallFailed
from virtualenv.util.path import ensure_dir
from virtualenv.util.subprocess import run_cmd
from .api import ViaGlobalRefApi, ViaGlobalRefMeta
from .builtin.pypy.pypy3 import Pypy3Windows
class Venv(ViaGlobalRefApi):
def __init__(self, options, interpreter):
self.describe = options.describe
super().__init__(options, interpreter)
current = PythonInfo.current()
self.can_be_inline = interpreter is current and interpreter.executable == interpreter.system_executable
self._context = None
def _args(self):
return super()._args() + ([("describe", self.describe.__class__.__name__)] if self.describe else [])
@classmethod
def can_create(cls, interpreter):
if interpreter.has_venv:
meta = ViaGlobalRefMeta()
if interpreter.platform == "win32" and interpreter.version_info.major == 3:
meta = handle_store_python(meta, interpreter)
return meta
return None
def create(self):
if self.can_be_inline:
self.create_inline()
else:
self.create_via_sub_process()
for lib in self.libs:
ensure_dir(lib)
super().create()
self.executables_for_win_pypy_less_v37()
def executables_for_win_pypy_less_v37(self):
"""
PyPy <= 3.6 (v7.3.3) for Windows contains only pypy3.exe and pypy3w.exe
Venv does not handle non-existing exe sources, e.g. python.exe, so this
patch does it.
"""
creator = self.describe
if isinstance(creator, Pypy3Windows) and creator.less_v37:
for exe in creator.executables(self.interpreter):
exe.run(creator, self.symlinks)
def create_inline(self):
from venv import EnvBuilder
builder = EnvBuilder(
system_site_packages=self.enable_system_site_package,
clear=False,
symlinks=self.symlinks,
with_pip=False,
)
builder.create(str(self.dest))
def create_via_sub_process(self):
cmd = self.get_host_create_cmd()
logging.info("using host built-in venv to create via %s", " ".join(cmd))
code, out, err = run_cmd(cmd)
if code != 0:
raise ProcessCallFailed(code, out, err, cmd)
def get_host_create_cmd(self):
cmd = [self.interpreter.system_executable, "-m", "venv", "--without-pip"]
if self.enable_system_site_package:
cmd.append("--system-site-packages")
cmd.append("--symlinks" if self.symlinks else "--copies")
cmd.append(str(self.dest))
return cmd
def set_pyenv_cfg(self):
# prefer venv options over ours, but keep our extra
venv_content = copy(self.pyenv_cfg.refresh())
super().set_pyenv_cfg()
self.pyenv_cfg.update(venv_content)
def __getattribute__(self, item):
describe = object.__getattribute__(self, "describe")
if describe is not None and hasattr(describe, item):
element = getattr(describe, item)
if not callable(element) or item in ("script",):
return element
return object.__getattribute__(self, item)
__all__ = [
"Venv",
]
|