X7ROOT File Manager
Current Path:
/opt/alt/python312/lib/python3.12/site-packages/setuptools
opt
/
alt
/
python312
/
lib
/
python3.12
/
site-packages
/
setuptools
/
ðŸ“
..
📄
__init__.py
(9 KB)
ðŸ“
__pycache__
📄
_core_metadata.py
(8.71 KB)
ðŸ“
_distutils
📄
_entry_points.py
(2.18 KB)
📄
_imp.py
(2.38 KB)
📄
_importlib.py
(1.43 KB)
📄
_itertools.py
(675 B)
📄
_normalization.py
(4.12 KB)
📄
_path.py
(1.03 KB)
📄
_reqs.py
(1.09 KB)
ðŸ“
_vendor
📄
archive_util.py
(7.16 KB)
📄
build_meta.py
(18.23 KB)
ðŸ“
command
ðŸ“
config
📄
dep_util.py
(659 B)
📄
depends.py
(5.45 KB)
📄
discovery.py
(20.65 KB)
📄
dist.py
(36.33 KB)
📄
errors.py
(2.61 KB)
📄
extension.py
(5.46 KB)
ðŸ“
extern
📄
glob.py
(4.75 KB)
📄
installer.py
(4.87 KB)
📄
launch.py
(812 B)
📄
logging.py
(1.21 KB)
📄
modified.py
(190 B)
📄
monkey.py
(4.67 KB)
📄
msvc.py
(46.31 KB)
📄
namespaces.py
(3 KB)
📄
package_index.py
(37.45 KB)
📄
py312compat.py
(330 B)
📄
sandbox.py
(14.01 KB)
📄
script (dev).tmpl
(218 B)
📄
script.tmpl
(138 B)
📄
unicode_utils.py
(941 B)
📄
version.py
(161 B)
📄
warnings.py
(3.61 KB)
📄
wheel.py
(8.43 KB)
📄
windows_support.py
(720 B)
Editing: namespaces.py
import os from distutils import log import itertools flatten = itertools.chain.from_iterable class Installer: nspkg_ext = '-nspkg.pth' def install_namespaces(self): nsp = self._get_all_ns_packages() if not nsp: return filename = self._get_nspkg_file() self.outputs.append(filename) log.info("Installing %s", filename) lines = map(self._gen_nspkg_line, nsp) if self.dry_run: # always generate the lines, even in dry run list(lines) return with open(filename, 'wt') as f: f.writelines(lines) def uninstall_namespaces(self): filename = self._get_nspkg_file() if not os.path.exists(filename): return log.info("Removing %s", filename) os.remove(filename) def _get_nspkg_file(self): filename, _ = os.path.splitext(self._get_target()) return filename + self.nspkg_ext def _get_target(self): return self.target _nspkg_tmpl = ( "import sys, types, os", "has_mfs = sys.version_info > (3, 5)", "p = os.path.join(%(root)s, *%(pth)r)", "importlib = has_mfs and __import__('importlib.util')", "has_mfs and __import__('importlib.machinery')", ( "m = has_mfs and " "sys.modules.setdefault(%(pkg)r, " "importlib.util.module_from_spec(" "importlib.machinery.PathFinder.find_spec(%(pkg)r, " "[os.path.dirname(p)])))" ), ("m = m or " "sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))"), "mp = (m or []) and m.__dict__.setdefault('__path__',[])", "(p not in mp) and mp.append(p)", ) "lines for the namespace installer" _nspkg_tmpl_multi = ('m and setattr(sys.modules[%(parent)r], %(child)r, m)',) "additional line(s) when a parent package is indicated" def _get_root(self): return "sys._getframe(1).f_locals['sitedir']" def _gen_nspkg_line(self, pkg): pth = tuple(pkg.split('.')) root = self._get_root() tmpl_lines = self._nspkg_tmpl parent, sep, child = pkg.rpartition('.') if parent: tmpl_lines += self._nspkg_tmpl_multi return ';'.join(tmpl_lines) % locals() + '\n' def _get_all_ns_packages(self): """Return sorted list of all package namespaces""" pkgs = self.distribution.namespace_packages or [] return sorted(set(flatten(map(self._pkg_names, pkgs)))) @staticmethod def _pkg_names(pkg): """ Given a namespace package, yield the components of that package. >>> names = Installer._pkg_names('a.b.c') >>> set(names) == set(['a', 'a.b', 'a.b.c']) True """ parts = pkg.split('.') while parts: yield '.'.join(parts) parts.pop() class DevelopInstaller(Installer): def _get_root(self): return repr(str(self.egg_path)) def _get_target(self): return self.egg_link
Upload File
Create Folder