Skip to content

Commit 0d01f66

Browse files
committedMay 18, 2018
Slightly better setup.
1 parent 11a80d4 commit 0d01f66

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed
 

‎paths.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# These are the paths for my laptop! I'm sure they're different for you, so update these so they're right.
2+
# If you don't have them, just leave it as-is, but you won't be able to use autogen for that program.
3+
Pcrystal: /home/brian/bin/Pcrystal
4+
Pproperties: /home/brian/bin/Pproperties
5+
crystal: /home/brian/bin/crystal
6+
properties: /home/brian/bin/properties
7+
pyscf: /home/brian/programs/pyscf
8+
qwalk: /home/brian/bin/qwalk

‎setup.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1+
import yaml
12
import os
23

34
print()
45
print("Setting up paths.")
56
print()
7+
print("To use this, make sure you fill out 'paths.yaml'")
68
print("You'll need to know the location of Crystal, Crystal's properties component, QWalk,")
79
print("and the PySCF library if you want to use any of them in autogen.")
8-
print("Use absolute paths.")
10+
print("Use absolute paths where possible.")
911
print()
1012

1113
curpaths={}
12-
keys=['Pcrystal','Pproperties','qwalk','pyscf']
14+
keys=['crystal','Pcrystal','properties','Pproperties','qwalk','pyscf']
15+
16+
input_paths=yaml.load(open('paths.yaml'))
1317

1418
for key in sorted(keys):
15-
path=input("--Enter path for %s (empty to disable): "%key)
16-
if path=='':
17-
path=None
19+
if key in input_paths and os.path.exists(input_paths[key]):
20+
path=input_paths[key]
21+
curpaths[key]=path
1822
else:
19-
assert os.path.exists(path),\
20-
"Couldn't find '%s', you should check that it exists, or that it's spelled correctly."%path
21-
curpaths[key]=path
23+
print("Didn't find path for %s, either update it in paths.json, or avoid using it with autogen."%key)
2224

2325
with open('autopaths.py','w') as outf:
2426
outf.write('paths={}'.format(curpaths))

0 commit comments

Comments
 (0)
Please sign in to comment.