MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / versions_from_parentdir

Function versions_from_parentdir

versioneer.py:1358–1382  ·  view source on GitHub ↗

Try to determine the version from the parent directory name. Source tarballs conventionally unpack into a directory that includes both the project name and a version string. We will also support searching up two directory levels for an appropriately named parent directory

(parentdir_prefix, root, verbose)

Source from the content-addressed store, hash-verified

1356
1357
1358def versions_from_parentdir(parentdir_prefix, root, verbose):
1359 """Try to determine the version from the parent directory name.
1360
1361 Source tarballs conventionally unpack into a directory that includes both
1362 the project name and a version string. We will also support searching up
1363 two directory levels for an appropriately named parent directory
1364 """
1365 rootdirs = []
1366
1367 for _ in range(3):
1368 dirname = os.path.basename(root)
1369 if dirname.startswith(parentdir_prefix):
1370 return {
1371 "version": dirname[len(parentdir_prefix) :],
1372 "full-revisionid": None,
1373 "dirty": False,
1374 "error": None,
1375 "date": None,
1376 }
1377 rootdirs.append(root)
1378 root = os.path.dirname(root) # up a level
1379
1380 if verbose:
1381 print("Tried directories %s but none started with prefix %s" % (str(rootdirs), parentdir_prefix))
1382 raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
1383
1384
1385SHORT_VERSION_PY = """

Callers 1

get_versionsFunction · 0.70

Calls 2

NotThisMethodClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…