Commit 2d33fbf9 authored by Romain Casati's avatar Romain Casati
Browse files

Main setup.py: better ressource lookup.

parent 31e278e6
...@@ -29,9 +29,9 @@ command = sys.argv[1] ...@@ -29,9 +29,9 @@ command = sys.argv[1]
if command == "sdist": if command == "sdist":
# use version number for cache busting # use version number for cache busting
src_dest = ((root_dir / "src" / "basthon-js", '.'), src_dest = ((root_dir / "src" / "basthon-js", ('*.js', '*.js.map'), '.'),
(root_dir / "src" / "basthon-py" / "build", Path(BASTHON_KERNEL_VERSION) / "basthon-py"), (root_dir / "src" / "basthon-py" / "build", ('*.js', '*.data'), Path(BASTHON_KERNEL_VERSION) / "basthon-py"),
(root_dir / "src" / "modules", Path(BASTHON_KERNEL_VERSION) / "modules")) (root_dir / "src" / "modules", ('*.whl', 'extern/*'), Path(BASTHON_KERNEL_VERSION) / "modules"))
# before creating the distribution, copy files from other locations in # before creating the distribution, copy files from other locations in
# the repository # the repository
...@@ -42,10 +42,10 @@ if command == "sdist": ...@@ -42,10 +42,10 @@ if command == "sdist":
# copy files from basthon into data_dir # copy files from basthon into data_dir
content = [] content = []
for src, dest in src_dest: for src, globs, dest in src_dest:
for path in src.rglob("*"): for glob in globs:
exts = ('.js', '.map', '.data') if path.parent == src else ('.whl',) for path in src.rglob(glob):
if path.is_file() and path.suffix in exts: if path.is_file():
dst = data_dir / dest / path.name dst = data_dir / dest / path.name
dst.parent.mkdir(parents=True, exist_ok=True) dst.parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(path, dst) shutil.copyfile(path, dst)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment