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

Function get_standard_file

numpy/distutils/system_info.py:382–414  ·  view source on GitHub ↗

Returns a list of files named 'fname' from 1) System-wide directory (directory-location of this module) 2) Users HOME directory (os.environ['HOME']) 3) Local directory

(fname)

Source from the content-addressed store, hash-verified

380
381
382def get_standard_file(fname):
383 """Returns a list of files named 'fname' from
384 1) System-wide directory (directory-location of this module)
385 2) Users HOME directory (os.environ['HOME'])
386 3) Local directory
387 """
388 # System-wide file
389 filenames = []
390 try:
391 f = __file__
392 except NameError:
393 f = sys.argv[0]
394 sysfile = os.path.join(os.path.split(os.path.abspath(f))[0],
395 fname)
396 if os.path.isfile(sysfile):
397 filenames.append(sysfile)
398
399 # Home directory
400 # And look for the user config file
401 try:
402 f = os.path.expanduser('~')
403 except KeyError:
404 pass
405 else:
406 user_file = os.path.join(f, fname)
407 if os.path.isfile(user_file):
408 filenames.append(user_file)
409
410 # Local file
411 if os.path.isfile(fname):
412 filenames.append(os.path.abspath(fname))
413
414 return filenames
415
416
417def _parse_env_order(base_order, env):

Callers 1

__init__Method · 0.85

Calls 3

joinMethod · 0.45
splitMethod · 0.45
abspathMethod · 0.45

Tested by

no test coverage detected