Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.distlib.database Namespace Reference

Data Structures

class  _Cache
 
class  BaseInstalledDistribution
 
class  DependencyGraph
 
class  Distribution
 
class  DistributionPath
 
class  EggInfoDistribution
 
class  InstalledDistribution
 

Functions

 make_graph (dists, scheme='default')
 
 get_dependent_dists (dists, dist)
 
 get_required_dists (dists, dist)
 
 make_dist (name, version, **kwargs)
 

Variables

 logger = logging.getLogger(__name__)
 
str EXPORTS_FILENAME = 'pydist-exports.json'
 
str COMMANDS_FILENAME = 'pydist-commands.json'
 
tuple DIST_FILES
 
str DISTINFO_EXT = '.dist-info'
 
 new_dist_class = InstalledDistribution
 
 old_dist_class = EggInfoDistribution
 

Detailed Description

PEP 376 implementation.

Function Documentation

◆ get_dependent_dists()

get_dependent_dists (   dists,
  dist 
)
Recursively generate a list of distributions from *dists* that are
dependent on *dist*.

:param dists: a list of distributions
:param dist: a distribution, member of *dists* for which we are interested

Definition at line 1286 of file database.py.

1286def get_dependent_dists(dists, dist):
1287 """Recursively generate a list of distributions from *dists* that are
1288 dependent on *dist*.
1289
1290 :param dists: a list of distributions
1291 :param dist: a distribution, member of *dists* for which we are interested
1292 """
1293 if dist not in dists:
1294 raise DistlibException('given distribution %r is not a member '
1295 'of the list' % dist.name)
1296 graph = make_graph(dists)
1297
1298 dep = [dist] # dependent distributions
1299 todo = graph.reverse_list[dist] # list of nodes we should inspect
1300
1301 while todo:
1302 d = todo.pop()
1303 dep.append(d)
1304 for succ in graph.reverse_list[d]:
1305 if succ not in dep:
1306 todo.append(succ)
1307
1308 dep.pop(0) # remove dist from dep, was there to prevent infinite loops
1309 return dep
1310
1311
for i

References i, and pip._vendor.distlib.database.make_graph().

Here is the call graph for this function:

◆ get_required_dists()

get_required_dists (   dists,
  dist 
)
Recursively generate a list of distributions from *dists* that are
required by *dist*.

:param dists: a list of distributions
:param dist: a distribution, member of *dists* for which we are interested
             in finding the dependencies.

Definition at line 1312 of file database.py.

1312def get_required_dists(dists, dist):
1313 """Recursively generate a list of distributions from *dists* that are
1314 required by *dist*.
1315
1316 :param dists: a list of distributions
1317 :param dist: a distribution, member of *dists* for which we are interested
1318 in finding the dependencies.
1319 """
1320 if dist not in dists:
1321 raise DistlibException('given distribution %r is not a member '
1322 'of the list' % dist.name)
1323 graph = make_graph(dists)
1324
1325 req = set() # required distributions
1326 todo = graph.adjacency_list[dist] # list of nodes we should inspect
1327 seen = set(t[0] for t in todo) # already added to todo
1328
1329 while todo:
1330 d = todo.pop()[0]
1331 req.add(d)
1332 pred_list = graph.adjacency_list[d]
1333 for pred in pred_list:
1334 d = pred[0]
1335 if d not in req and d not in seen:
1336 seen.add(d)
1337 todo.append(pred)
1338 return req
1339
1340

References i, and pip._vendor.distlib.database.make_graph().

Here is the call graph for this function:

◆ make_dist()

make_dist (   name,
  version,
**  kwargs 
)
A convenience method for making a dist given just a name and version.

Definition at line 1341 of file database.py.

1341def make_dist(name, version, **kwargs):
1342 """
1343 A convenience method for making a dist given just a name and version.
1344 """
1345 summary = kwargs.pop('summary', 'Placeholder for summary')
1346 md = Metadata(**kwargs)
1347 md.name = name
1348 md.version = version
1349 md.summary = summary or 'Placeholder for summary'
1350 return Distribution(md)

References i.

◆ make_graph()

make_graph (   dists,
  scheme = 'default' 
)
Makes a dependency graph from the given distributions.

:parameter dists: a list of distributions
:type dists: list of :class:`distutils2.database.InstalledDistribution` and
             :class:`distutils2.database.EggInfoDistribution` instances
:rtype: a :class:`DependencyGraph` instance

Definition at line 1232 of file database.py.

1232def make_graph(dists, scheme='default'):
1233 """Makes a dependency graph from the given distributions.
1234
1235 :parameter dists: a list of distributions
1236 :type dists: list of :class:`distutils2.database.InstalledDistribution` and
1237 :class:`distutils2.database.EggInfoDistribution` instances
1238 :rtype: a :class:`DependencyGraph` instance
1239 """
1240 scheme = get_scheme(scheme)
1241 graph = DependencyGraph()
1242 provided = {} # maps names to lists of (version, dist) tuples
1243
1244 # first, build the graph and find out what's provided
1245 for dist in dists:
1247
1248 for p in dist.provides:
1249 name, version = parse_name_and_version(p)
1250 logger.debug('Add to provided: %s, %s, %s', name, version, dist)
1251 provided.setdefault(name, []).append((version, dist))
1252
1253 # now make the edges
1254 for dist in dists:
1257 for req in requires:
1258 try:
1259 matcher = scheme.matcher(req)
1260 except UnsupportedVersionError:
1261 # XXX compat-mode if cannot read the version
1262 logger.warning('could not read version %r - using name only',
1263 req)
1264 name = req.split()[0]
1265 matcher = scheme.matcher(name)
1266
1267 name = matcher.key # case-insensitive
1268
1269 matched = False
1270 if name in provided:
1271 for version, provider in provided[name]:
1272 try:
1273 match = matcher.match(version)
1274 except UnsupportedVersionError:
1275 match = False
1276
1277 if match:
1278 graph.add_edge(dist, provider, req)
1279 matched = True
1280 break
1281 if not matched:
1282 graph.add_missing(dist, req)
1283 return graph
1284
1285

References i.

Referenced by pip._vendor.distlib.database.get_dependent_dists(), and pip._vendor.distlib.database.get_required_dists().

Here is the caller graph for this function:

Variable Documentation

◆ COMMANDS_FILENAME

str COMMANDS_FILENAME = 'pydist-commands.json'

Definition at line 37 of file database.py.

◆ DIST_FILES

tuple DIST_FILES
Initial value:
1= ('INSTALLER', METADATA_FILENAME, 'RECORD', 'REQUESTED',
2 'RESOURCES', EXPORTS_FILENAME, 'SHARED')

Definition at line 39 of file database.py.

◆ DISTINFO_EXT

str DISTINFO_EXT = '.dist-info'

Definition at line 42 of file database.py.

◆ EXPORTS_FILENAME

str EXPORTS_FILENAME = 'pydist-exports.json'

Definition at line 36 of file database.py.

◆ logger

logger = logging.getLogger(__name__)

Definition at line 34 of file database.py.

◆ new_dist_class

new_dist_class = InstalledDistribution

Definition at line 1084 of file database.py.

Referenced by DistributionPath._yield_distributions().

◆ old_dist_class

old_dist_class = EggInfoDistribution

Definition at line 1085 of file database.py.

Referenced by DistributionPath._yield_distributions().