MCPcopy Create free account
hub / github.com/numpy/numpy / cyg2win32

Function cyg2win32

numpy/distutils/misc_util.py:386–420  ·  view source on GitHub ↗

Convert a path from Cygwin-native to Windows-native. Uses the cygpath utility (part of the Base install) to do the actual conversion. Falls back to returning the original path if this fails. Handles the default ``/cygdrive`` mount prefix as well as the ``/proc/cygdrive`` porta

(path: str)

Source from the content-addressed store, hash-verified

384#########################
385
386def cyg2win32(path: str) -> str:
387 """Convert a path from Cygwin-native to Windows-native.
388
389 Uses the cygpath utility (part of the Base install) to do the
390 actual conversion. Falls back to returning the original path if
391 this fails.
392
393 Handles the default ``/cygdrive`` mount prefix as well as the
394 ``/proc/cygdrive`` portable prefix, custom cygdrive prefixes such
395 as ``/`` or ``/mnt``, and absolute paths such as ``/usr/src/`` or
396 ``/home/username``
397
398 Parameters
399 ----------
400 path : str
401 The path to convert
402
403 Returns
404 -------
405 converted_path : str
406 The converted path
407
408 Notes
409 -----
410 Documentation for cygpath utility:
411 https://cygwin.com/cygwin-ug-net/cygpath.html
412 Documentation for the C function it wraps:
413 https://cygwin.com/cygwin-api/func-cygwin-conv-path.html
414
415 """
416 if sys.platform != "cygwin":
417 return path
418 return subprocess.check_output(
419 ["/usr/bin/cygpath", "--windows", path], text=True
420 )
421
422
423def mingw32():

Callers 2

CCompiler_compileFunction · 0.90
update_executablesMethod · 0.90

Calls 1

check_outputMethod · 0.45

Tested by

no test coverage detected