Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6056b20

Browse files
Merge pull request #5299 from plotly/fix-local-commands
fix: add missing arguments to commands.py
2 parents 372b014 + cf6f44a commit 6056b20

File tree

1 file changed

+23
-33
lines changed

1 file changed

+23
-33
lines changed

‎commands.py

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -244,27 +244,10 @@ def update_plotlyjs(plotly_js_version, outdir):
244244

245245

246246
# FIXME: switch to argparse
247-
def update_schema_bundle_from_master():
247+
def update_schema_bundle_from_master(args):
248248
"""Update the plotly.js schema and bundle from master."""
249-
250-
if "--devrepo" in sys.argv:
251-
devrepo = sys.argv[sys.argv.index("--devrepo") + 1]
252-
else:
253-
devrepo = "plotly/plotly.js"
254-
255-
if "--devbranch" in sys.argv:
256-
devbranch = sys.argv[sys.argv.index("--devbranch") + 1]
257-
else:
258-
devbranch = "master"
259-
260-
if "--local" in sys.argv:
261-
local = sys.argv[sys.argv.index("--local") + 1]
262-
else:
263-
local = None
264-
265-
if local is None:
266-
build_info = get_latest_publish_build_info(devrepo, devbranch)
267-
249+
if args.local is None:
250+
build_info = get_latest_publish_build_info(args.devrepo, args.devbranch)
268251
archive_url, bundle_url, schema_url = get_bundle_schema_urls(
269252
build_info["build_num"]
270253
)
@@ -275,14 +258,14 @@ def update_schema_bundle_from_master():
275258
# Update schema in package data
276259
overwrite_schema(schema_url)
277260
else:
278-
# this info could be more informative but
279-
# it doesn't seem as useful in a local context
280-
# and requires dependencies and programming.
261+
# this info could be more informative but it doesn't seem as
262+
# useful in a local context and requires dependencies and
263+
# programming.
281264
build_info = {"vcs_revision": "local", "committer_date": str(time.time())}
282-
devrepo = local
283-
devbranch = ""
265+
args.devrepo = args.local
266+
args.devbranch = ""
284267

285-
archive_uri, bundle_uri, schema_uri = get_bundle_schema_local(local)
268+
archive_uri, bundle_uri, schema_uri = get_bundle_schema_local(args.local)
286269
overwrite_bundle_local(bundle_uri)
287270
overwrite_schema_local(schema_uri)
288271

@@ -293,23 +276,23 @@ def update_schema_bundle_from_master():
293276

294277
# Replace version with bundle url
295278
package_json["dependencies"]["plotly.js"] = (
296-
archive_url if local is None else archive_uri
279+
archive_url if args.local is None else archive_uri
297280
)
298281
with open(package_json_path, "w") as f:
299282
json.dump(package_json, f, indent=2)
300283

301284
# update plotly.js version in _plotlyjs_version
302285
rev = build_info["vcs_revision"]
303286
date = str(build_info["committer_date"])
304-
version = "_".join([devrepo, devbranch, date[:10], rev[:8]])
287+
version = "_".join([args.devrepo, args.devbranch, date[:10], rev[:8]])
305288
overwrite_plotlyjs_version_file(version)
306-
install_js_deps(local)
289+
install_js_deps(args.local)
307290

308291

309-
def update_plotlyjs_dev(outdir):
292+
def update_plotlyjs_dev(args, outdir):
310293
"""Update project to a new development version of plotly.js."""
311294

312-
update_schema_bundle_from_master()
295+
update_schema_bundle_from_master(args)
313296
perform_codegen(outdir)
314297

315298

@@ -328,7 +311,14 @@ def parse_args():
328311

329312
subparsers.add_parser("format", help="reformat code")
330313

331-
subparsers.add_parser("updateplotlyjsdev", help="update plotly.js for development")
314+
p_update_dev = subparsers.add_parser(
315+
"updateplotlyjsdev", help="update plotly.js for development"
316+
)
317+
p_update_dev.add_argument(
318+
"--devrepo", default="plotly/plotly.js", help="repository"
319+
)
320+
p_update_dev.add_argument("--devbranch", default="master", help="branch")
321+
p_update_dev.add_argument("--local", default=None, help="local path")
332322

333323
subparsers.add_parser("updateplotlyjs", help="update plotly.js")
334324

@@ -353,7 +343,7 @@ def main():
353343
lint_code(outdir)
354344

355345
elif args.cmd == "updateplotlyjsdev":
356-
update_plotlyjs_dev(outdir)
346+
update_plotlyjs_dev(args, outdir)
357347

358348
elif args.cmd == "updateplotlyjs":
359349
version = plotly_js_version()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /