Python pip._vendor.pkg_resources.PathMetadata() Examples

The following are 30 code examples of pip._vendor.pkg_resources.PathMetadata(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pip._vendor.pkg_resources , or try the search function .
Example #1
Source File: req_install.py    From pex with Apache License 2.0 6 votes vote down vote up
def _get_dist(metadata_directory):
    # type: (str) -> Distribution
    """Return a pkg_resources.Distribution for the provided
    metadata directory.
    """
    dist_dir = metadata_directory.rstrip(os.sep)

    # Determine the correct Distribution object type.
    if dist_dir.endswith(".egg-info"):
        dist_cls = pkg_resources.Distribution
    else:
        assert dist_dir.endswith(".dist-info")
        dist_cls = pkg_resources.DistInfoDistribution

    # Build a PathMetadata object, from path to metadata. :wink:
    base_dir, dist_dir_name = os.path.split(dist_dir)
    dist_name = os.path.splitext(dist_dir_name)[0]
    metadata = pkg_resources.PathMetadata(base_dir, dist_dir)

    return dist_cls(
        base_dir,
        project_name=dist_name,
        metadata=metadata,
    ) 
Example #2
Source File: req_install.py    From Hands-On-Application-Development-with-PyCharm with MIT License 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #3
Source File: req_install.py    From learn_python3_spider with MIT License 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #4
Source File: req_install.py    From scylla with Apache License 2.0 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #5
Source File: req_install.py    From Building-Recommendation-Systems-with-Python with MIT License 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #6
Source File: req_install.py    From Building-Recommendation-Systems-with-Python with MIT License 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #7
Source File: req_install.py    From Weapon-Detection-And-Classification with MIT License 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #8
Source File: req_install.py    From coffeegrindsize with MIT License 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #9
Source File: req_install.py    From CogAlg with MIT License 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        dist_dir = self.metadata_directory.rstrip(os.sep)

        # Determine the correct Distribution object type.
        if dist_dir.endswith(".egg-info"):
            dist_cls = pkg_resources.Distribution
        else:
            assert dist_dir.endswith(".dist-info")
            dist_cls = pkg_resources.DistInfoDistribution

        # Build a PathMetadata object, from path to metadata. :wink:
        base_dir, dist_dir_name = os.path.split(dist_dir)
        dist_name = os.path.splitext(dist_dir_name)[0]
        metadata = pkg_resources.PathMetadata(base_dir, dist_dir)

        return dist_cls(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #10
Source File: req_install.py    From deepWordBug with Apache License 2.0 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #11
Source File: req_install.py    From Carnets with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #12
Source File: req_install.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            dist_dir = self.metadata_directory
            dist_cls = pkg_resources.DistInfoDistribution
        else:
            dist_dir = self.egg_info_path.rstrip(os.path.sep)
            # https://github.com/python/mypy/issues/1174
            dist_cls = pkg_resources.Distribution  # type: ignore

        # dist_dir_name can be of the form "<project>.dist-info" or
        # e.g. "<project>.egg-info".
        base_dir, dist_dir_name = os.path.split(dist_dir)
        dist_name = os.path.splitext(dist_dir_name)[0]
        metadata = pkg_resources.PathMetadata(base_dir, dist_dir)

        return dist_cls(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #13
Source File: req_install.py    From Mastering-Elasticsearch-7.0 with MIT License 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #14
Source File: req_install.py    From Mastering-Elasticsearch-7.0 with MIT License 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #15
Source File: req_install.py    From android_universal with MIT License 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #16
Source File: req_install.py    From rules_pip with MIT License 6 votes vote down vote up
def _get_dist(metadata_directory):
    # type: (str) -> Distribution
    """Return a pkg_resources.Distribution for the provided
    metadata directory.
    """
    dist_dir = metadata_directory.rstrip(os.sep)

    # Build a PathMetadata object, from path to metadata. :wink:
    base_dir, dist_dir_name = os.path.split(dist_dir)
    metadata = pkg_resources.PathMetadata(base_dir, dist_dir)

    # Determine the correct Distribution object type.
    if dist_dir.endswith(".egg-info"):
        dist_cls = pkg_resources.Distribution
        dist_name = os.path.splitext(dist_dir_name)[0]
    else:
        assert dist_dir.endswith(".dist-info")
        dist_cls = pkg_resources.DistInfoDistribution
        dist_name = os.path.splitext(dist_dir_name)[0].split("-")[0]

    return dist_cls(
        base_dir,
        project_name=dist_name,
        metadata=metadata,
    ) 
Example #17
Source File: req_install.py    From fxxkpython with GNU General Public License v3.0 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #18
Source File: req_install.py    From fxxkpython with GNU General Public License v3.0 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #19
Source File: req_install.py    From fxxkpython with GNU General Public License v3.0 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #20
Source File: req_install.py    From fxxkpython with GNU General Public License v3.0 6 votes vote down vote up
def get_dist(self):
        # type: () -> Distribution
        """Return a pkg_resources.Distribution for this requirement"""
        if self.metadata_directory:
            base_dir, distinfo = os.path.split(self.metadata_directory)
            metadata = pkg_resources.PathMetadata(
                base_dir, self.metadata_directory
            )
            dist_name = os.path.splitext(distinfo)[0]
            typ = pkg_resources.DistInfoDistribution
        else:
            egg_info = self.egg_info_path.rstrip(os.path.sep)
            base_dir = os.path.dirname(egg_info)
            metadata = pkg_resources.PathMetadata(base_dir, egg_info)
            dist_name = os.path.splitext(os.path.basename(egg_info))[0]
            # https://github.com/python/mypy/issues/1174
            typ = pkg_resources.Distribution  # type: ignore

        return typ(
            base_dir,
            project_name=dist_name,
            metadata=metadata,
        ) 
Example #21
Source File: req_install.py    From ImageFusion with MIT License 5 votes vote down vote up
def get_dist(self):
        """Return a pkg_resources.Distribution built from self.egg_info_path"""
        egg_info = self.egg_info_path('').rstrip('/')
        base_dir = os.path.dirname(egg_info)
        metadata = pkg_resources.PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        return pkg_resources.Distribution(
            os.path.dirname(egg_info),
            project_name=dist_name,
            metadata=metadata) 
Example #22
Source File: req_install.py    From python2017 with MIT License 5 votes vote down vote up
def get_dist(self):
        """Return a pkg_resources.Distribution built from self.egg_info_path"""
        egg_info = self.egg_info_path('').rstrip('/')
        base_dir = os.path.dirname(egg_info)
        metadata = pkg_resources.PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        return pkg_resources.Distribution(
            os.path.dirname(egg_info),
            project_name=dist_name,
            metadata=metadata) 
Example #23
Source File: req_install.py    From Ansible with MIT License 5 votes vote down vote up
def get_dist(self):
        """Return a pkg_resources.Distribution built from self.egg_info_path"""
        egg_info = self.egg_info_path('').rstrip('/')
        base_dir = os.path.dirname(egg_info)
        metadata = pkg_resources.PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        return pkg_resources.Distribution(
            os.path.dirname(egg_info),
            project_name=dist_name,
            metadata=metadata) 
Example #24
Source File: req_install.py    From datafari with Apache License 2.0 5 votes vote down vote up
def get_dist(self):
        """Return a pkg_resources.Distribution built from self.egg_info_path"""
        egg_info = self.egg_info_path('').rstrip('/')
        base_dir = os.path.dirname(egg_info)
        metadata = pkg_resources.PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        return pkg_resources.Distribution(
            os.path.dirname(egg_info),
            project_name=dist_name,
            metadata=metadata) 
Example #25
Source File: req_install.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def get_dist(self):
        """Return a pkg_resources.Distribution built from self.egg_info_path"""
        egg_info = self.egg_info_path('').rstrip('/')
        base_dir = os.path.dirname(egg_info)
        metadata = pkg_resources.PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        return pkg_resources.Distribution(
            os.path.dirname(egg_info),
            project_name=dist_name,
            metadata=metadata) 
Example #26
Source File: req_install.py    From python with Apache License 2.0 5 votes vote down vote up
def get_dist(self):
        """Return a pkg_resources.Distribution built from self.egg_info_path"""
        egg_info = self.egg_info_path('').rstrip('/')
        base_dir = os.path.dirname(egg_info)
        metadata = pkg_resources.PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        return pkg_resources.Distribution(
            os.path.dirname(egg_info),
            project_name=dist_name,
            metadata=metadata) 
Example #27
Source File: req_install.py    From PhonePi_SampleServer with MIT License 5 votes vote down vote up
def get_dist(self):
        """Return a pkg_resources.Distribution built from self.egg_info_path"""
        egg_info = self.egg_info_path('').rstrip('/')
        base_dir = os.path.dirname(egg_info)
        metadata = pkg_resources.PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        return pkg_resources.Distribution(
            os.path.dirname(egg_info),
            project_name=dist_name,
            metadata=metadata) 
Example #28
Source File: req_install.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def get_dist(self):
        """Return a pkg_resources.Distribution built from self.egg_info_path"""
        egg_info = self.egg_info_path('').rstrip('/')
        base_dir = os.path.dirname(egg_info)
        metadata = pkg_resources.PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        return pkg_resources.Distribution(
            os.path.dirname(egg_info),
            project_name=dist_name,
            metadata=metadata) 
Example #29
Source File: req_install.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def get_dist(self):
        """Return a pkg_resources.Distribution built from self.egg_info_path"""
        egg_info = self.egg_info_path('').rstrip('/')
        base_dir = os.path.dirname(egg_info)
        metadata = pkg_resources.PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        return pkg_resources.Distribution(
            os.path.dirname(egg_info),
            project_name=dist_name,
            metadata=metadata) 
Example #30
Source File: req_install.py    From guildai with Apache License 2.0 5 votes vote down vote up
def get_dist(self):
        """Return a pkg_resources.Distribution built from self.egg_info_path"""
        egg_info = self.egg_info_path('').rstrip(os.path.sep)
        base_dir = os.path.dirname(egg_info)
        metadata = pkg_resources.PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        return pkg_resources.Distribution(
            os.path.dirname(egg_info),
            project_name=dist_name,
            metadata=metadata,
        )