mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-23 15:48:09 +02:00
[config] default stub install verbose
This commit is contained in:
parent
3460b967a2
commit
096254a49c
4 changed files with 46 additions and 9 deletions
26
setup.py
26
setup.py
|
|
@ -146,3 +146,29 @@ setup(name = 'GPy',
|
|||
'Programming Language :: Python :: 2.7',
|
||||
'Topic :: Scientific/Engineering :: Artificial Intelligence']
|
||||
)
|
||||
|
||||
|
||||
# Check config files and settings:
|
||||
local_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'GPy', 'installation.cfg'))
|
||||
home = os.getenv('HOME') or os.getenv('USERPROFILE')
|
||||
user_file = os.path.join(home,'.config', 'GPy', 'user.cfg')
|
||||
|
||||
print("")
|
||||
if not os.path.exists(user_file):
|
||||
# Does an old config exist?
|
||||
old_user_file = os.path.join(home,'.gpy_user.cfg')
|
||||
if os.path.exists(old_user_file):
|
||||
# Move it to new location:
|
||||
print("GPy: Found old config file, moving to new location {}".format(user_file))
|
||||
os.rename(old_user_file, user_file)
|
||||
else:
|
||||
# No config file exists, save informative stub to user config folder:
|
||||
print("GPy: Saving user configuration file to {}".format(user_file))
|
||||
if not os.path.exists(os.path.dirname(user_file)):
|
||||
os.makedirs(os.path.dirname(user_file))
|
||||
with open(user_file, 'w') as f:
|
||||
with open(local_file, 'r') as l:
|
||||
tmp = l.read()
|
||||
f.write(tmp)
|
||||
else:
|
||||
print("GPy: User configuration file at location {}".format(user_file))
|
||||
Loading…
Add table
Add a link
Reference in a new issue