Skip to content

Commit 44daadb

Browse files
authored
Add --editable option for install and update commands. (#546)
1 parent 6e3b839 commit 44daadb

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

etstool.py

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
github_url_fmt = "git+http://github.com/enthought/{0}.git#egg={0}"
112112

113113

114+
# Click options shared by multiple commands.
114115
edm_option = click.option(
115116
"--edm",
116117
help=(
@@ -120,14 +121,18 @@
120121
),
121122
envvar="ETSTOOL_EDM",
122123
)
123-
124124
runtime_option = click.option(
125125
'--runtime',
126126
default=default_runtime,
127127
type=click.Choice(supported_runtimes),
128128
show_default=True,
129129
help="Python runtime version for the development environment",
130130
)
131+
editable_option = click.option(
132+
'--editable/--not-editable',
133+
default=False,
134+
help="Install main package in 'editable' mode? [default: --not-editable]",
135+
)
131136

132137

133138
@click.group()
@@ -142,9 +147,10 @@ def cli():
142147
@edm_option
143148
@runtime_option
144149
@click.option('--environment', default=None, help='Name of the EDM environment to install')
150+
@editable_option
145151
@click.option('--docs/--no-docs', default=True)
146152
@click.option('--source/--no-source', default=False)
147-
def install(edm, runtime, environment, docs, source):
153+
def install(edm, runtime, environment, editable, docs, source):
148154
""" Install project and dependencies into a clean EDM environment and
149155
optionally install further dependencies required for building
150156
documentation.
@@ -163,8 +169,19 @@ def install(edm, runtime, environment, docs, source):
163169
"{edm} environments create {environment} --force --version={runtime}",
164170
"{edm} install -y -e {environment} " + packages,
165171
"{edm} plumbing remove-package -e {environment} traits",
166-
"{edm} run -e {environment} -- python -m pip install --no-deps .",
167172
]
173+
if editable:
174+
install_cmd = (
175+
"{edm} run -e {environment} -- "
176+
"python -m pip install --editable . --no-dependencies"
177+
)
178+
else:
179+
install_cmd = (
180+
"{edm} run -e {environment} -- "
181+
"python -m pip install . --no-dependencies"
182+
)
183+
commands.append(install_cmd)
184+
168185
click.echo("Creating environment '{environment}'".format(**parameters))
169186
execute(commands, parameters)
170187
if source:
@@ -284,14 +301,23 @@ def test_clean(edm, runtime):
284301
@edm_option
285302
@runtime_option
286303
@click.option('--environment', default=None, help='Name of EDM environment to update.')
287-
def update(edm, runtime, environment):
304+
@editable_option
305+
def update(edm, runtime, environment, editable):
288306
""" Update/Reinstall package into environment.
289307
290308
"""
291309
parameters = get_parameters(edm, runtime, environment)
292-
commands = [
293-
"{edm} run -e {environment} -- python -m pip install --no-deps .",
294-
]
310+
if editable:
311+
install_cmd = (
312+
"{edm} run -e {environment} -- "
313+
"python -m pip install --editable . --no-dependencies"
314+
)
315+
else:
316+
install_cmd = (
317+
"{edm} run -e {environment} -- "
318+
"python -m pip install . --no-dependencies"
319+
)
320+
commands = [install_cmd]
295321
click.echo("Re-installing in '{environment}'".format(**parameters))
296322
execute(commands, parameters)
297323
click.echo('Done update')

0 commit comments

Comments
 (0)