/usr/lib/python2.7/dist-packages/sfepy/config.py is in python-sfepy 2016.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | import sys
import os
import shutil
msg_unknown_os = """could not determine operating system!
try setting it in site_cfg.py manually, see site_cfg_template.py"""
msg_numpydoc = """could not find numpydoc!
If it is installed in a non-standard location, try setting it in
site_cfg.py manually."""
if not os.path.exists('site_cfg.py'):
try:
shutil.copyfile('site_cfg_template.py', 'site_cfg.py')
except:
pass
try:
import site_cfg
except ImportError:
site_cfg = None
has_attr = lambda obj, attr: obj and hasattr(obj, attr)
class Config(object):
def python_version(self):
if has_attr(site_cfg, 'python_version'):
if site_cfg.python_version == 'auto':
return "%d.%d" % tuple(sys.version_info[:2])
else:
return site_cfg.python_version
else:
return "%d.%d" % tuple(sys.version_info[:2])
def python_include(self):
if (has_attr(site_cfg, 'python_include')
and (site_cfg.python_include != 'auto')):
return site_cfg.python_include
else:
system = self.system()
if system == 'posix':
version = self.python_version()
return os.path.join(sys.prefix, 'include', 'python' + version)
else:
return os.path.join(sys.prefix, 'include')
def system(self):
if has_attr(site_cfg, 'system') and site_cfg.system is not None:
return site_cfg.system
else:
if os.name in ['posix']:
return 'posix'
elif os.name in ['nt']:
return 'windows'
else:
raise ValueError(msg_unknown_os)
def compile_flags(self):
if has_attr(site_cfg, 'compile_flags'):
flags = site_cfg.compile_flags
else:
flags = '-g -O2'
return flags.split()
def link_flags(self):
if has_attr(site_cfg, 'link_flags'):
flags = site_cfg.link_flags
else:
flags = ''
return flags.split()
def debug_flags(self):
if has_attr(site_cfg, 'debug_flags'):
return site_cfg.debug_flags
else:
return ''
def numpydoc_path(self):
if (has_attr(site_cfg, 'numpydoc_path') and
(site_cfg.numpydoc_path is not None)):
return site_cfg.numpydoc_path
else:
try:
import numpydoc
except ImportError:
raise ValueError(msg_numpydoc)
def is_release(self):
if has_attr(site_cfg, 'is_release'):
return site_cfg.is_release
else:
return ''
def tetgen_path(self):
if has_attr(site_cfg, 'tetgen_path'):
return site_cfg.tetgen_path
else:
return '/usr/bin/tetgen'
|