Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/virtualenv/info.py @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author | shellac |
---|---|
date | Sat, 02 May 2020 07:14:21 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:26e78fe6e8c4 |
---|---|
1 from __future__ import absolute_import, unicode_literals | |
2 | |
3 import logging | |
4 import os | |
5 import platform | |
6 import sys | |
7 import tempfile | |
8 | |
9 IMPLEMENTATION = platform.python_implementation() | |
10 IS_PYPY = IMPLEMENTATION == "PyPy" | |
11 IS_CPYTHON = IMPLEMENTATION == "CPython" | |
12 PY3 = sys.version_info[0] == 3 | |
13 PY2 = sys.version_info[0] == 2 | |
14 IS_WIN = sys.platform == "win32" | |
15 ROOT = os.path.realpath(os.path.join(os.path.abspath(__file__), os.path.pardir, os.path.pardir)) | |
16 IS_ZIPAPP = os.path.isfile(ROOT) | |
17 WIN_CPYTHON_2 = IS_CPYTHON and IS_WIN and PY2 | |
18 | |
19 _CAN_SYMLINK = _FS_CASE_SENSITIVE = _CFG_DIR = _DATA_DIR = None | |
20 | |
21 | |
22 def fs_is_case_sensitive(): | |
23 global _FS_CASE_SENSITIVE | |
24 | |
25 if _FS_CASE_SENSITIVE is None: | |
26 with tempfile.NamedTemporaryFile(prefix="TmP") as tmp_file: | |
27 _FS_CASE_SENSITIVE = not os.path.exists(tmp_file.name.lower()) | |
28 logging.debug("filesystem is %scase-sensitive", "" if _FS_CASE_SENSITIVE else "not ") | |
29 return _FS_CASE_SENSITIVE | |
30 | |
31 | |
32 def fs_supports_symlink(): | |
33 global _CAN_SYMLINK | |
34 | |
35 if _CAN_SYMLINK is None: | |
36 can = False | |
37 if hasattr(os, "symlink"): | |
38 if IS_WIN: | |
39 with tempfile.NamedTemporaryFile(prefix="TmP") as tmp_file: | |
40 temp_dir = os.path.dirname(tmp_file.name) | |
41 dest = os.path.join(temp_dir, "{}-{}".format(tmp_file.name, "b")) | |
42 try: | |
43 os.symlink(tmp_file.name, dest) | |
44 can = True | |
45 except (OSError, NotImplementedError): | |
46 pass | |
47 logging.debug("symlink on filesystem does%s work", "" if can else " not") | |
48 else: | |
49 can = True | |
50 _CAN_SYMLINK = can | |
51 return _CAN_SYMLINK | |
52 | |
53 | |
54 __all__ = ( | |
55 "IS_PYPY", | |
56 "IS_CPYTHON", | |
57 "PY3", | |
58 "PY2", | |
59 "IS_WIN", | |
60 "fs_is_case_sensitive", | |
61 "fs_supports_symlink", | |
62 "ROOT", | |
63 "IS_ZIPAPP", | |
64 "WIN_CPYTHON_2", | |
65 ) |