From 419f0825dd65b291e98a87ce552149a58542deeb Mon Sep 17 00:00:00 2001 From: martinRenou Date: Thu, 28 Apr 2022 17:57:52 +0200 Subject: [PATCH] Add setup.py This installs the emsdk script as a proper Python entry point --- .gitignore | 3 +++ MANIFEST.in | 1 + emsdk | 2 +- emsdkpy/__init__.py | 1 + emcmdprompt.bat => emsdkpy/emcmdprompt.bat | 0 .../emscripten-releases-tags.json | 0 emsdk.bat => emsdkpy/emsdk.bat | 0 emsdk.ps1 => emsdkpy/emsdk.ps1 | 0 emsdk.py => emsdkpy/emsdk.py | 6 +++-- emsdk_env.bat => emsdkpy/emsdk_env.bat | 0 emsdk_env.csh => emsdkpy/emsdk_env.csh | 0 emsdk_env.fish => emsdkpy/emsdk_env.fish | 0 emsdk_env.ps1 => emsdkpy/emsdk_env.ps1 | 0 emsdk_env.sh => emsdkpy/emsdk_env.sh | 0 .../emsdk_manifest.json | 0 .../legacy-binaryen-tags.txt | 0 .../legacy-emscripten-tags.txt | 0 .../llvm-tags-64bit.txt | 0 setup.cfg | 26 +++++++++++++++++++ setup.py | 3 +++ 20 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 MANIFEST.in mode change 100755 => 100644 emsdk create mode 100644 emsdkpy/__init__.py rename emcmdprompt.bat => emsdkpy/emcmdprompt.bat (100%) rename emscripten-releases-tags.json => emsdkpy/emscripten-releases-tags.json (100%) rename emsdk.bat => emsdkpy/emsdk.bat (100%) rename emsdk.ps1 => emsdkpy/emsdk.ps1 (100%) rename emsdk.py => emsdkpy/emsdk.py (99%) rename emsdk_env.bat => emsdkpy/emsdk_env.bat (100%) rename emsdk_env.csh => emsdkpy/emsdk_env.csh (100%) rename emsdk_env.fish => emsdkpy/emsdk_env.fish (100%) rename emsdk_env.ps1 => emsdkpy/emsdk_env.ps1 (100%) rename emsdk_env.sh => emsdkpy/emsdk_env.sh (100%) rename emsdk_manifest.json => emsdkpy/emsdk_manifest.json (100%) rename legacy-binaryen-tags.txt => emsdkpy/legacy-binaryen-tags.txt (100%) rename legacy-emscripten-tags.txt => emsdkpy/legacy-emscripten-tags.txt (100%) rename llvm-tags-64bit.txt => emsdkpy/llvm-tags-64bit.txt (100%) create mode 100644 setup.cfg create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 0d794d22d0..6b3b6e0426 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ *.pyc __pycache__ +emsdk.egg-info +dist +build # Support for --embedded configs /.emscripten diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000000..71081d7f16 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +recursive-include emsdk diff --git a/emsdk b/emsdk old mode 100755 new mode 100644 index 98b8d84ac2..061ccee6a1 --- a/emsdk +++ b/emsdk @@ -44,4 +44,4 @@ if [ -z "$EMSDK_PYTHON" ]; then EMSDK_PYTHON=python fi -exec "$EMSDK_PYTHON" "$0.py" "$@" +exec "$EMSDK_PYTHON" "emsdkpy/$0.py" "$@" diff --git a/emsdkpy/__init__.py b/emsdkpy/__init__.py new file mode 100644 index 0000000000..3cada642a0 --- /dev/null +++ b/emsdkpy/__init__.py @@ -0,0 +1 @@ +from .emsdk import main # noqa diff --git a/emcmdprompt.bat b/emsdkpy/emcmdprompt.bat similarity index 100% rename from emcmdprompt.bat rename to emsdkpy/emcmdprompt.bat diff --git a/emscripten-releases-tags.json b/emsdkpy/emscripten-releases-tags.json similarity index 100% rename from emscripten-releases-tags.json rename to emsdkpy/emscripten-releases-tags.json diff --git a/emsdk.bat b/emsdkpy/emsdk.bat similarity index 100% rename from emsdk.bat rename to emsdkpy/emsdk.bat diff --git a/emsdk.ps1 b/emsdkpy/emsdk.ps1 similarity index 100% rename from emsdk.ps1 rename to emsdkpy/emsdk.ps1 diff --git a/emsdk.py b/emsdkpy/emsdk.py similarity index 99% rename from emsdk.py rename to emsdkpy/emsdk.py index 1b5fc79a54..d4b08965dc 100644 --- a/emsdk.py +++ b/emsdkpy/emsdk.py @@ -2833,7 +2833,9 @@ def expand_sdk_name(name, activating): return name -def main(args): +def main(): + args = sys.argv[1:] + if not args: errlog("Missing command; Type 'emsdk help' to get a list of commands.") return 1 @@ -3268,4 +3270,4 @@ def print_tools(t): if __name__ == '__main__': - sys.exit(main(sys.argv[1:])) + sys.exit(main()) diff --git a/emsdk_env.bat b/emsdkpy/emsdk_env.bat similarity index 100% rename from emsdk_env.bat rename to emsdkpy/emsdk_env.bat diff --git a/emsdk_env.csh b/emsdkpy/emsdk_env.csh similarity index 100% rename from emsdk_env.csh rename to emsdkpy/emsdk_env.csh diff --git a/emsdk_env.fish b/emsdkpy/emsdk_env.fish similarity index 100% rename from emsdk_env.fish rename to emsdkpy/emsdk_env.fish diff --git a/emsdk_env.ps1 b/emsdkpy/emsdk_env.ps1 similarity index 100% rename from emsdk_env.ps1 rename to emsdkpy/emsdk_env.ps1 diff --git a/emsdk_env.sh b/emsdkpy/emsdk_env.sh similarity index 100% rename from emsdk_env.sh rename to emsdkpy/emsdk_env.sh diff --git a/emsdk_manifest.json b/emsdkpy/emsdk_manifest.json similarity index 100% rename from emsdk_manifest.json rename to emsdkpy/emsdk_manifest.json diff --git a/legacy-binaryen-tags.txt b/emsdkpy/legacy-binaryen-tags.txt similarity index 100% rename from legacy-binaryen-tags.txt rename to emsdkpy/legacy-binaryen-tags.txt diff --git a/legacy-emscripten-tags.txt b/emsdkpy/legacy-emscripten-tags.txt similarity index 100% rename from legacy-emscripten-tags.txt rename to emsdkpy/legacy-emscripten-tags.txt diff --git a/llvm-tags-64bit.txt b/emsdkpy/llvm-tags-64bit.txt similarity index 100% rename from llvm-tags-64bit.txt rename to emsdkpy/llvm-tags-64bit.txt diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000000..45f52102da --- /dev/null +++ b/setup.cfg @@ -0,0 +1,26 @@ +[metadata] +name = emsdk +version = 3.1.9 +description = Emscripten SDK +long_description = file: README.md +long_description_content_type = text/markdown +license_file = LICENSE +author = Emscripten authors +url = https://github.com/emscripten-core/emsdk +platforms = Windows, Linux, Mac OS X +keywords = emscripten, sdk + +[bdist_wheel] +universal = 1 + +[options] +include_package_data = True +packages = find: +python_requires = >=3.7 + +[options.entry_points] +console_scripts = + emsdk = emsdkpy.emsdk:main + +[options.package_data] +emsdkpy = *.txt, *.bat, *.csh, *.fish, *.ps1, *.sh, *.json diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000..b908cbe55c --- /dev/null +++ b/setup.py @@ -0,0 +1,3 @@ +import setuptools + +setuptools.setup()