Skip to content

Commit

Permalink
Fix diff_match_patch downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
yacchin1205 authored and yMlkdsDws committed Oct 10, 2022
1 parent cc1c09b commit 4a8ff53
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,3 @@ recursive-include lc_multi_outputs *.png
recursive-include lc_multi_outputs *.yml
recursive-include schema *.json
recursive-include .vscode *.json

global-exclude lc_multi_outputs/nbextension/lib/diff_match_patch.js
2 changes: 1 addition & 1 deletion lc_multi_outputs/nbextension/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require.config({
map: {
'*': {
"diff_match_patch": "nbextensions/multi_outputs/lib/diff_match_patch"
"diff_match_patch": "nbextensions/lc_multi_outputs/lib/diff_match_patch"
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ build_cmd = "build:prod"
npm = ["jlpm"]

[tool.check-manifest]
ignore = ["lc_multi_outputs/labextension/**", "yarn.lock", ".*", "package-lock.json"]
ignore = ["lc_multi_outputs/labextension/**", "yarn.lock", ".*", "package-lock.json", "lc_multi_outputs/nbextension/lib/diff_match_patch.js"]
17 changes: 13 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@
.replace("-rc.", "rc")
)

with open(os.path.join(LIB, 'diff_match_patch.js'), 'wb') as f:
f.write(urlopen('https://github.com/google/diff-match-patch/raw/master/javascript/diff_match_patch.js').read())

setup_args = dict(
name=name,
version=version,
Expand Down Expand Up @@ -89,10 +86,22 @@
npm_builder,
get_data_files
)
def download_diff_match_patch():
if not os.path.exists(LIB):
os.mkdir(LIB)
with open(os.path.join(LIB, 'diff_match_patch.js'), 'wb') as f:
f.write(urlopen('https://github.com/google/diff-match-patch/raw/master/javascript/diff_match_patch.js').read())

pre_dist = pre_develop = download_diff_match_patch
post_develop = npm_builder(
build_cmd="install:extension", source_dir="src", build_dir=lab_path
)
setup_args["cmdclass"] = wrap_installers(post_develop=post_develop, ensured_targets=ensured_targets)
setup_args["cmdclass"] = wrap_installers(
pre_develop=pre_develop,
pre_dist=pre_dist,
post_develop=post_develop,
ensured_targets=ensured_targets
)
setup_args["data_files"] = get_data_files(data_files_spec)
except ImportError as e:
import logging
Expand Down

0 comments on commit 4a8ff53

Please sign in to comment.