Python pip._vendor.pkg_resources.DistInfoDistribution() Examples
The following are 30
code examples of pip._vendor.pkg_resources.DistInfoDistribution().
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: packaging.py From rules_pip with MIT License | 6 votes |
def get_metadata(dist): # type: (Distribution) -> Message """ :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. """ metadata_name = 'METADATA' if (isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata(metadata_name)): metadata = dist.get_metadata(metadata_name) elif dist.has_metadata('PKG-INFO'): metadata_name = 'PKG-INFO' metadata = dist.get_metadata(metadata_name) else: logger.warning("No metadata found in %s", display_path(dist.location)) metadata = '' if metadata is None: raise NoneMetadataError(dist, metadata_name) feed_parser = FeedParser() # The following line errors out if with a "NoneType" TypeError if # passed metadata=None. feed_parser.feed(metadata) return feed_parser.close()
Example #2
Source File: packaging.py From pex with Apache License 2.0 | 6 votes |
def get_metadata(dist): # type: (Distribution) -> Message """ :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. """ metadata_name = 'METADATA' if (isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata(metadata_name)): metadata = dist.get_metadata(metadata_name) elif dist.has_metadata('PKG-INFO'): metadata_name = 'PKG-INFO' metadata = dist.get_metadata(metadata_name) else: logger.warning("No metadata found in %s", display_path(dist.location)) metadata = '' if metadata is None: raise NoneMetadataError(dist, metadata_name) feed_parser = FeedParser() # The following line errors out if with a "NoneType" TypeError if # passed metadata=None. feed_parser.feed(metadata) return feed_parser.close()
Example #3
Source File: req_install.py From fxxkpython with GNU General Public License v3.0 | 6 votes |
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 android_universal with MIT License | 6 votes |
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 Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
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 Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
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 fxxkpython with GNU General Public License v3.0 | 6 votes |
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 fxxkpython with GNU General Public License v3.0 | 6 votes |
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 pex with Apache License 2.0 | 6 votes |
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 #10
Source File: req_install.py From deepWordBug with Apache License 2.0 | 6 votes |
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 V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 6 votes |
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 #12
Source File: req_install.py From Carnets with BSD 3-Clause "New" or "Revised" License | 6 votes |
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 #13
Source File: req_install.py From CogAlg with MIT License | 6 votes |
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 #14
Source File: packaging.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 6 votes |
def get_metadata(dist): # type: (Distribution) -> Message """ :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. """ metadata_name = 'METADATA' if (isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata(metadata_name)): metadata = dist.get_metadata(metadata_name) elif dist.has_metadata('PKG-INFO'): metadata_name = 'PKG-INFO' metadata = dist.get_metadata(metadata_name) else: logger.warning("No metadata found in %s", display_path(dist.location)) metadata = '' if metadata is None: raise NoneMetadataError(dist, metadata_name) feed_parser = FeedParser() # The following line errors out if with a "NoneType" TypeError if # passed metadata=None. feed_parser.feed(metadata) return feed_parser.close()
Example #15
Source File: req_install.py From rules_pip with MIT License | 6 votes |
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 #16
Source File: req_install.py From Weapon-Detection-And-Classification with MIT License | 6 votes |
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 #17
Source File: req_install.py From Hands-On-Application-Development-with-PyCharm with MIT License | 6 votes |
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 learn_python3_spider with MIT License | 6 votes |
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 coffeegrindsize with MIT License | 6 votes |
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 scylla with Apache License 2.0 | 6 votes |
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: packaging.py From CogAlg with MIT License | 6 votes |
def get_metadata(dist): # type: (Distribution) -> Message """ :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. """ metadata_name = 'METADATA' if (isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata(metadata_name)): metadata = dist.get_metadata(metadata_name) elif dist.has_metadata('PKG-INFO'): metadata_name = 'PKG-INFO' metadata = dist.get_metadata(metadata_name) else: logger.warning("No metadata found in %s", display_path(dist.location)) metadata = '' if metadata is None: raise NoneMetadataError(dist, metadata_name) feed_parser = FeedParser() # The following line errors out if with a "NoneType" TypeError if # passed metadata=None. feed_parser.feed(metadata) return feed_parser.close()
Example #22
Source File: req_install.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
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 #23
Source File: req_install.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
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 #24
Source File: packaging.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def get_metadata(dist): if (isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata('METADATA')): return dist.get_metadata('METADATA') elif dist.has_metadata('PKG-INFO'): return dist.get_metadata('PKG-INFO')
Example #25
Source File: packaging.py From twitter-stock-recommendation with MIT License | 5 votes |
def get_metadata(dist): if (isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata('METADATA')): return dist.get_metadata('METADATA') elif dist.has_metadata('PKG-INFO'): return dist.get_metadata('PKG-INFO')
Example #26
Source File: packaging.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def get_metadata(dist): # type: (Distribution) -> Message if (isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata('METADATA')): metadata = dist.get_metadata('METADATA') elif dist.has_metadata('PKG-INFO'): metadata = dist.get_metadata('PKG-INFO') else: logger.warning("No metadata found in %s", display_path(dist.location)) metadata = '' feed_parser = FeedParser() feed_parser.feed(metadata) return feed_parser.close()
Example #27
Source File: packaging.py From PhonePi_SampleServer with MIT License | 5 votes |
def get_metadata(dist): if (isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata('METADATA')): return dist.get_metadata('METADATA') elif dist.has_metadata('PKG-INFO'): return dist.get_metadata('PKG-INFO')
Example #28
Source File: packaging.py From python2017 with MIT License | 5 votes |
def get_metadata(dist): if (isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata('METADATA')): return dist.get_metadata('METADATA') elif dist.has_metadata('PKG-INFO'): return dist.get_metadata('PKG-INFO')
Example #29
Source File: packaging.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def get_metadata(dist): # type: (Distribution) -> Message if (isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata('METADATA')): metadata = dist.get_metadata('METADATA') elif dist.has_metadata('PKG-INFO'): metadata = dist.get_metadata('PKG-INFO') else: logger.warning("No metadata found in %s", display_path(dist.location)) metadata = '' feed_parser = FeedParser() feed_parser.feed(metadata) return feed_parser.close()
Example #30
Source File: packaging.py From android_universal with MIT License | 5 votes |
def get_metadata(dist): # type: (Distribution) -> Message if (isinstance(dist, pkg_resources.DistInfoDistribution) and dist.has_metadata('METADATA')): metadata = dist.get_metadata('METADATA') elif dist.has_metadata('PKG-INFO'): metadata = dist.get_metadata('PKG-INFO') else: logger.warning("No metadata found in %s", display_path(dist.location)) metadata = '' feed_parser = FeedParser() feed_parser.feed(metadata) return feed_parser.close()