MCPcopy Create free account
hub / github.com/microsoft/debugpy / do_vcs_install

Function do_vcs_install

versioneer.py:1311–1345  ·  view source on GitHub ↗

Git-specific installation logic for Versioneer. For Git, this means creating/changing .gitattributes to mark _version.py for export-subst keyword substitution.

(versionfile_source, ipy)

Source from the content-addressed store, hash-verified

1309
1310
1311def do_vcs_install(versionfile_source, ipy):
1312 """Git-specific installation logic for Versioneer.
1313
1314 For Git, this means creating/changing .gitattributes to mark _version.py
1315 for export-subst keyword substitution.
1316 """
1317 GITS = ["git"]
1318 if sys.platform == "win32":
1319 GITS = ["git.cmd", "git.exe"]
1320 files = [versionfile_source]
1321 if ipy:
1322 files.append(ipy)
1323 try:
1324 my_path = __file__
1325 if my_path.endswith(".pyc") or my_path.endswith(".pyo"):
1326 my_path = os.path.splitext(my_path)[0] + ".py"
1327 versioneer_file = os.path.relpath(my_path)
1328 except NameError:
1329 versioneer_file = "versioneer.py"
1330 files.append(versioneer_file)
1331 present = False
1332 try:
1333 with open(".gitattributes", "r") as fobj:
1334 for line in fobj:
1335 if line.strip().startswith(versionfile_source):
1336 if "export-subst" in line.strip().split()[1:]:
1337 present = True
1338 break
1339 except OSError:
1340 pass
1341 if not present:
1342 with open(".gitattributes", "a+") as fobj:
1343 fobj.write(f"{versionfile_source} export-subst\n")
1344 files.append(".gitattributes")
1345 run_command(GITS, ["add", "--"] + files)
1346
1347
1348def versions_from_parentdir(parentdir_prefix, root, verbose):

Callers 1

do_setupFunction · 0.85

Calls 3

run_commandFunction · 0.70
appendMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…