Re @sqddlZddlmZddlZddlmZejjZGdddZ Gddde Z dS)N)log)mapc @s|eZdZdZddZddZddZdZdZddZ ddZ ddZ e ddZ dS) Installerz -nspkg.pthc Cs|j}|sdStjj|j\}}||j7}|jj|tj d|t |j |}|j rt |dSt|d}|j|WdQRXdS)Nz Installing %swt)_get_all_ns_packagesospathsplitext _get_target nspkg_extoutputsappendrinfor_gen_nspkg_linedry_runlistopen writelines)selfnspfilenameextlinesfr/builddir/build/BUILDROOT/alt-python35-setuptools-36.3.0-4.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/setuptools/namespaces.pyinstall_namespacess    zInstaller.install_namespacescCsbtjj|j\}}||j7}tjj|sAdStjd|tj|dS)Nz Removing %s) rrr r r existsrrremove)rrrrrruninstall_namespaces!s  zInstaller.uninstall_namespacescCs|jS)N)target)rrrrr )szInstaller._get_targetimport sys, types, os#has_mfs = sys.version_info > (3, 5)$p = os.path.join(%(root)s, *%(pth)r)4importlib = 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)])))Cm = m or sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))7mp = (m or []) and m.__dict__.setdefault('__path__',[])(p not in mp) and mp.append(p)4m and setattr(sys.modules[%(parent)r], %(child)r, m)cCsdS)Nz$sys._getframe(1).f_locals['sitedir']r)rrrr _get_rootCszInstaller._get_rootcCsyt|}t|jd}|j}|j}|jd\}}}|ra||j7}dj|tdS)N.; ) strtuplesplitr+ _nspkg_tmpl rpartition_nspkg_tmpl_multijoinlocals)rpkgpthrootZ tmpl_linesparentsepchildrrrrFs    zInstaller._gen_nspkg_linecCs.|jjpg}ttt|j|S)z,Return sorted list of all package namespaces) distributionZnamespace_packagessortedflattenr _pkg_names)rpkgsrrrrQszInstaller._get_all_ns_packagesccs8|jd}x"|r3dj|V|jqWdS)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)r1r5pop)r7partsrrrr@Vs  zInstaller._pkg_namesN) r!r"r#r$r%r&r'r(r))r*)__name__ __module__ __qualname__r rrr r2r4r+rr staticmethodr@rrrrr s$      rc@s(eZdZddZddZdS)DevelopInstallercCstt|jS)N)reprr/Zegg_path)rrrrr+gszDevelopInstaller._get_rootcCs|jS)N)egg_link)rrrrr jszDevelopInstaller._get_targetN)rDrErFr+r rrrrrHfs  rH) r distutilsr itertoolsZsetuptools.extern.six.movesrchain from_iterabler?rrHrrrrs   [