a (Re @sFddlZddlmZddlZejjZGdddZGdddeZdS)N)logc@sTeZdZdZddZddZddZdZd Zd d Z d d Z ddZ e ddZ dS) Installerz -nspkg.pthcCs|}|sdStj|\}}||j7}|j|t d|t |j |}|j rdt |dSt|d}||Wdn1s0YdS)Nz Installing %swt)_get_all_ns_packagesospathsplitext _get_target nspkg_extoutputsappendrinfomap_gen_nspkg_linedry_runlistopen writelines)selfnspfilenameextlinesfr/builddir/build/BUILDROOT/alt-python39-setuptools-58.3.0-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/setuptools/namespaces.pyinstall_namespaces s     zInstaller.install_namespacescCsHtj|\}}||j7}tj|s.dStd|t|dS)Nz Removing %s) rrrr r existsrr remove)rrrrrruninstall_namespacess    zInstaller.uninstall_namespacescCs|jSN)targetrrrrr 'szInstaller._get_target) zimport sys, types, osz#has_mfs = sys.version_info > (3, 5)z$p = os.path.join(%(root)s, *%(pth)r)z4importlib = has_mfs and __import__('importlib.util')z-has_mfs and __import__('importlib.machinery')zm = has_mfs and sys.modules.setdefault(%(pkg)r, importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec(%(pkg)r, [os.path.dirname(p)])))zCm = m or sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))z7mp = (m or []) and m.__dict__.setdefault('__path__',[])z(p not in mp) and mp.append(p))z4m and setattr(sys.modules[%(parent)r], %(child)r, m)cCsdS)Nz$sys._getframe(1).f_locals['sitedir']rr"rrr _get_rootEszInstaller._get_rootcCsNt|d}|}|j}|d\}}}|r:||j7}d|tdS)N.; )tuplesplitr# _nspkg_tmpl rpartition_nspkg_tmpl_multijoinlocals)rpkgpthrootZ tmpl_linesparentsepchildrrrrHs zInstaller._gen_nspkg_linecCs |jjp g}ttt|j|S)z,Return sorted list of all package namespaces) distributionZnamespace_packagessortedflattenr _pkg_names)rpkgsrrrrQs zInstaller._get_all_ns_packagesccs(|d}|r$d|V|q dS)z 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 r$N)r(r,pop)r.partsrrrr7Vs  zInstaller._pkg_namesN)__name__ __module__ __qualname__r rrr r)r+r#rr staticmethodr7rrrrr s rc@seZdZddZddZdS)DevelopInstallercCstt|jSr )reprstrZegg_pathr"rrrr#gszDevelopInstaller._get_rootcCs|jSr )egg_linkr"rrrr jszDevelopInstaller._get_targetN)r;r<r=r#r rrrrr?fsr?) r distutilsr itertoolschain from_iterabler6rr?rrrrs  ]