PNG  IHDR  8] PLTE S =tRNS   PNG  IHDR  8] PLTE S =tRNS   REDROOM
PHP 7.4.33
Preview: develop.py Size: 8.00 KB
/opt/alt/python27/lib/python2.7/site-packages/setuptools/command/develop.py

from distutils.util import convert_path
from distutils import log
from distutils.errors import DistutilsError, DistutilsOptionError
import os
import glob
import io

from setuptools.extern import six

import pkg_resources
from setuptools.command.easy_install import easy_install
from setuptools import namespaces
import setuptools

__metaclass__ = type


class develop(namespaces.DevelopInstaller, easy_install):
    """Set up package for development"""

    description = "install package in 'development mode'"

    user_options = easy_install.user_options + [
        ("uninstall", "u", "Uninstall this source package"),
        ("egg-path=", None, "Set the path to be used in the .egg-link file"),
    ]

    boolean_options = easy_install.boolean_options + ['uninstall']

    command_consumes_arguments = False  # override base

    def run(self):
        if self.uninstall:
            self.multi_version = True
            self.uninstall_link()
            self.uninstall_namespaces()
        else:
            self.install_for_development()
        self.warn_deprecated_options()

    def initialize_options(self):
        self.uninstall = None
        self.egg_path = None
        easy_install.initialize_options(self)
        self.setup_path = None
        self.always_copy_from = '.'  # always copy eggs installed in curdir

    def finalize_options(self):
        ei = self.get_finalized_command("egg_info")
        if ei.broken_egg_info:
            template = "Please rename %r to %r before using 'develop'"
            args = ei.egg_info, ei.broken_egg_info
            raise DistutilsError(template % args)
        self.args = [ei.egg_name]

        easy_install.finalize_options(self)
        self.expand_basedirs()
        self.expand_dirs()
        # pick up setup-dir .egg files only: no .egg-info
        self.package_index.scan(glob.glob('*.egg'))

        egg_link_fn = ei.egg_name + '.egg-link'
        self.egg_link = os.path.join(self.install_dir, egg_link_fn)
        self.egg_base = ei.egg_base
        if self.egg_path is None:
            self.egg_path = os.path.abspath(ei.egg_base)

        target = pkg_resources.normalize_path(self.egg_base)
        egg_path = pkg_resources.normalize_path(
            os.path.join(self.install_dir, self.egg_path))
        if egg_path != target:
            raise DistutilsOptionError(
                "--egg-path must be a relative path from the install"
                " directory to " + target
            )

        # Make a distribution for the package's source
        self.dist = pkg_resources.Distribution(
            target,
            pkg_resources.PathMetadata(target, os.path.abspath(ei.egg_info)),
            project_name=ei.egg_name
        )

        self.setup_path = self._resolve_setup_path(
            self.egg_base,
            self.install_dir,
            self.egg_path,
        )

    @staticmethod
    def _resolve_setup_path(egg_base, install_dir, egg_path):
        """
        Generate a path from egg_base back to '.' where the
        setup script resides and ensure that path points to the
        setup path from $install_dir/$egg_path.
        """
        path_to_setup = egg_base.replace(os.sep, '/').rstrip('/')
        if path_to_setup != os.curdir:
            path_to_setup = '../' * (path_to_setup.count('/') + 1)
        resolved = pkg_resources.normalize_path(
            os.path.join(install_dir, egg_path, path_to_setup)
        )
        if resolved != pkg_resources.normalize_path(os.curdir):
            raise DistutilsOptionError(
                "Can't get a consistent path to setup script from"
                " installation directory", resolved,
                pkg_resources.normalize_path(os.curdir))
        return path_to_setup

    def install_for_development(self):
        if not six.PY2 and getattr(self.distribution, 'use_2to3', False):
            # If we run 2to3 we can not do this inplace:

            # Ensure metadata is up-to-date
            self.reinitialize_command('build_py', inplace=0)
            self.run_command('build_py')
            bpy_cmd = self.get_finalized_command("build_py")
            build_path = pkg_resources.normalize_path(bpy_cmd.build_lib)

            # Build extensions
            self.reinitialize_command('egg_info', egg_base=build_path)
            self.run_command('egg_info')

            self.reinitialize_command('build_ext', inplace=0)
            self.run_command('build_ext')

            # Fixup egg-link and easy-install.pth
            ei_cmd = self.get_finalized_command("egg_info")
            self.egg_path = build_path
            self.dist.location = build_path
            # XXX
            self.dist._provider = pkg_resources.PathMetadata(
                build_path, ei_cmd.egg_info)
        else:
            # Without 2to3 inplace works fine:
            self.run_command('egg_info')

            # Build extensions in-place
            self.reinitialize_command('build_ext', inplace=1)
            self.run_command('build_ext')

        self.install_site_py()  # ensure that target dir is site-safe
        if setuptools.bootstrap_install_from:
            self.easy_install(setuptools.bootstrap_install_from)
            setuptools.bootstrap_install_from = None

        self.install_namespaces()

        # create an .egg-link in the installation dir, pointing to our egg
        log.info("Creating %s (link to %s)", self.egg_link, self.egg_base)
        if not self.dry_run:
            with open(self.egg_link, "w") as f:
                f.write(self.egg_path + "\n" + self.setup_path)
        # postprocess the installed distro, fixing up .pth, installing scripts,
        # and handling requirements
        self.process_distribution(None, self.dist, not self.no_deps)

    def uninstall_link(self):
        if os.path.exists(self.egg_link):
            log.info("Removing %s (link to %s)", self.egg_link, self.egg_base)
            egg_link_file = open(self.egg_link)
            contents = [line.rstrip() for line in egg_link_file]
            egg_link_file.close()
            if contents not in ([self.egg_path],
                                [self.egg_path, self.setup_path]):
                log.warn("Link points to %s: uninstall aborted", contents)
                return
            if not self.dry_run:
                os.unlink(self.egg_link)
        if not self.dry_run:
            self.update_pth(self.dist)  # remove any .pth link to us
        if self.distribution.scripts:
            # XXX should also check for entry point scripts!
            log.warn("Note: you must uninstall or replace scripts manually!")

    def install_egg_scripts(self, dist):
        if dist is not self.dist:
            # Installing a dependency, so fall back to normal behavior
            return easy_install.install_egg_scripts(self, dist)

        # create wrapper scripts in the script dir, pointing to dist.scripts

        # new-style...
        self.install_wrapper_scripts(dist)

        # ...and old-style
        for script_name in self.distribution.scripts or []:
            script_path = os.path.abspath(convert_path(script_name))
            script_name = os.path.basename(script_path)
            with io.open(script_path) as strm:
                script_text = strm.read()
            self.install_script(dist, script_name, script_text, script_path)

    def install_wrapper_scripts(self, dist):
        dist = VersionlessRequirement(dist)
        return easy_install.install_wrapper_scripts(self, dist)


class VersionlessRequirement:
    """
    Adapt a pkg_resources.Distribution to simply return the project
    name as the 'requirement' so that scripts will work across
    multiple versions.

    >>> from pkg_resources import Distribution
    >>> dist = Distribution(project_name='foo', version='1.0')
    >>> str(dist.as_requirement())
    'foo==1.0'
    >>> adapted_dist = VersionlessRequirement(dist)
    >>> str(adapted_dist.as_requirement())
    'foo'
    """

    def __init__(self, dist):
        self.__dist = dist

    def __getattr__(self, name):
        return getattr(self.__dist, name)

    def as_requirement(self):
        return self.project_name

Directory Contents

Dirs: 0 × Files: 51

Name Size Perms Modified Actions
2.37 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
3.11 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
17.76 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
18.29 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
1.47 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
1.92 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
637 B lrw-r--r-- 2024-10-10 13:18:22
Edit Download
1.21 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
4.38 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
2.82 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
12.72 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
12.10 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
9.37 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
10.72 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
8.00 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
7.96 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
960 B lrw-r--r-- 2024-10-10 13:18:22
Edit Download
1.82 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
85.50 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
80.73 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
24.97 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
26.83 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
4.59 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
5.00 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
2.15 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
3.21 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
3.77 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
4.93 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
2.38 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
2.89 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
628 B lrw-r--r-- 2024-10-10 13:18:22
Edit Download
4.87 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
5.57 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
468 B lrw-r--r-- 2024-10-10 13:18:22
Edit Download
1.01 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
2.11 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
3.03 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
658 B lrw-r--r-- 2024-10-10 13:18:22
Edit Download
1.14 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
7.90 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
9.97 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
4.97 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
6.04 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
9.38 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
10.84 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
462 B lrw-r--r-- 2024-10-10 13:18:22
Edit Download
1012 B lrw-r--r-- 2024-10-10 13:18:22
Edit Download
7.14 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
7.80 KB lrw-r--r-- 2024-10-10 13:18:22
Edit Download
568 B lrw-r--r-- 2024-10-10 13:18:22
Edit Download
863 B lrw-r--r-- 2024-10-10 13:18:22
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).
 !"#$%&'(()*+,-./00123456789 t\ wIDATx ]ys  47Y ƒ -  "  Rv  < f{Ɛ $k l L > L  ~h^ 1  [  r G t& h  l F z3O Y ! p A(_g̷ E8 )S 8 c  Kb"z ~ 5 J xAL WU <  *  5 m;W a pB h ~P J 2 3 6 ҙ .Ƹ P i  4g F R L P ΪK/D  M v (a3 k J Œ4N5* SH ` SdJ z  O J Xՠ V>u ߱ BE&L b2 ?2` tX+  c CB A$ i b C ĀMB E : /  # Dx &l =q Ty  0 \p I ( L Ǎ { e 4k ;`u^ヲ eP!( d {  )T A 8 O;Ě n >;s6 !  :Nx `[S D HU ~ q›J F} a g*D 49 / pn k h (t 8NxƐF _!r չ7 ZR R׷ q/5") Ӎ NY 0 x sZ!   o  fu  ,  K"$ ? pg  㕣=  1» {h " fh7    y  } € +7  $ y " X —ą - G P u 4 m >J 5 L =V ' ^@I p ?MS xЌ XV P ! h "C NS9B8̢ ]!K  e   zA , ӏkbY  !< XQ ٿyS| *" f { w  4@[S <  # 0 ! js [m  =,~ o "ݎ DHf Wo $ g ! Vԅ t mB /y Wf V4񺍸 c+@x?  B ~u " xUN e 0 BĂ) ~J pz! 7y6]l Ԥ@ P a< O /DHC `≻  N m"$  0ObB }{ x AO FCG D R ^ "B  { WDH  UR l@ T #  +"d T ; 0 i  D}. 7 ` ' ] w rE &S i ƕiTD EL P _ u h $ Ա FG wVD G L R Zf ' .!] J /ZR oGЍs Mr Ĥ ʬ 3 Q [3 cL ` ^ p + ( F;# B 5 '  2Y f [  ϶R0e }  E 7 6M aۮ H <& n % L] E}Up x紉, Uw' Q  Ǯշo k ވۙ 0N94 VX5 xEDE l D #֤ } C o )W :  ^ s 9  bRf iX5u ཱི 4 :[  T 1. | [E 2ؽ Iy\ : o x K G 5 ylP ' uK E ftb/i[3 .g _  [3M n G, #NwQ5~  ؚ) | n =Ц"x qg gB ` 듘 ~ x w ? ? R~  _ u. &VQ K˻   H C ( TN˄+ `C dA nB׭ D 3"Z G ê ^k H_ /- ~ " R_  .8 Z_ 6@ o  xg  uP ? 3լ @7AM!  E7^ - =V L  x  g-D0  CtmW 7  O  G _ WD0 g C  w1 r d w : a | \  *" f nֳ ^ H# f L ` Z ۽hV  }S F r0Ù Bć5r] @! NL iQ]{s^=4 d  WD  "  "   M; t" 8 5 e dL| "-*st" ) SWD ?R[S e ooF  20.D ? bo =) A i o d ģ ZҰaO @E =) i D a &ܟa CϞ y6 ,<%{^x%{f8? `iw^ ?/ M * IEND B`