Skip to content

Commit c47cac7

Browse files
committed
#netpyne-132: installation refactoring
1 parent 0efb8f5 commit c47cac7

1 file changed

Lines changed: 17 additions & 20 deletions

File tree

utilities/install.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ def checkout(folder, branch_or_tag, cwdp):
7575

7676
print(f'Checking out {branch_or_tag}')
7777
try:
78+
subprocess.call(['git', 'fetch'], cwd=newPath)
7879
subprocess.call(['git', 'checkout', branch_or_tag], cwd=newPath)
80+
subprocess.call(['git', 'pull', 'origin', branch_or_tag], cwd=newPath)
7981
except Exception as e:
8082
logging.error('Cannot checkout branch or tag %s on %s', branch_or_tag, folder, exc_info=True)
8183

@@ -96,33 +98,28 @@ def main(netpyne_branch, workspace_branch, geppetto_branch=None, skipNpm=False,
9698

9799
if development:
98100
os.chdir(DEPS_DIR)
99-
100-
# cloning geppetto meta
101-
cprint("Installing geppetto-meta")
102-
clone(repository=META,
103-
folder=META_DIR,
104-
branch_or_tag=geppetto_branch
105-
)
106-
107101
# clone and install netpyne
108-
cprint("Installing netpyne")
109-
clone(repository=NETPYNE, branch_or_tag=netpyne_branch)
110-
execute(cmd=['pip', 'install', '-e', '.'], cwd=os.path.join(DEPS_DIR, NETPYNE_DIR))
111-
112-
# installing pygeppetto
113-
cprint("Installing pygeppetto")
114-
execute(cmd=['pip', 'install', '-e', '.'], cwd=os.path.join(DEPS_DIR, META_DIR, PYGEPPETTO_DIR))
115-
# installing jupyter geppetto
116-
cprint("Installing jupyter geppetto")
117-
execute(cmd=['pip', 'install', '-e', '.'], cwd=os.path.join(DEPS_DIR, META_DIR, JUPYTER_DIR))
118-
# installing core dependencies
119-
execute(cmd=['pip', 'install', '-e', '.'], cwd=ROOT_DIR)
102+
if geppetto_branch and geppetto_branch != 'master':
103+
cprint("Installing geppetto-meta")
104+
clone(repository=META, folder=META_DIR, branch_or_tag=geppetto_branch)
105+
# installing pygeppetto
106+
cprint("Installing pygeppetto")
107+
execute(cmd=['pip', 'install', '-e', '.'], cwd=os.path.join(DEPS_DIR, META_DIR, PYGEPPETTO_DIR))
108+
# installing jupyter geppetto
109+
cprint("Installing jupyter geppetto")
110+
execute(cmd=['pip', 'install', '-e', '.'], cwd=os.path.join(DEPS_DIR, META_DIR, JUPYTER_DIR))
111+
# installing core dependencies
112+
execute(cmd=['pip', 'install', '-e', '.'], cwd=ROOT_DIR)
120113
if netpyne_branch and netpyne_branch != 'master':
121114
cprint("Installing netpyne")
122115
clone(repository=NETPYNE, branch_or_tag=netpyne_branch)
123116
execute(cmd=['pip', 'install', '-e', '.'], cwd=os.path.join(DEPS_DIR, NETPYNE_DIR))
124117
else:
125118
# install requirements
119+
if geppetto_branch and geppetto_branch != 'master':
120+
sys.exit("ERROR: geppetto-meta branch not supported in production mode")
121+
if netpyne_branch and netpyne_branch != 'master':
122+
sys.exit("ERROR: netpyne branch not supported in production mode")
126123
cprint("Installing UI python package...")
127124
execute(cmd=['pip', 'install', '-e', '.', '--no-deps'], cwd=ROOT_DIR)
128125

0 commit comments

Comments
 (0)