aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Burger-Scheidlin <7289824+cburger-scheidlin@users.noreply.github.com>2018-08-03 15:17:21 +0200
committerNirbheek Chauhan <nirbheek@centricular.com>2018-08-24 03:14:02 +0530
commitabb8860eea0636377c73343787f2193ba8d7a150 (patch)
tree21f143235e544334a937add186ee4f0a24df2eae
parent4ea9f630b8a907c2e2ac0aeb47453e5f18c50ddc (diff)
downloadmeson-abb8860eea0636377c73343787f2193ba8d7a150.zip
meson-abb8860eea0636377c73343787f2193ba8d7a150.tar.gz
meson-abb8860eea0636377c73343787f2193ba8d7a150.tar.bz2
Fix __main__.py for zipapp to work
0a035de removed main from meson.py breaking the call from __main__.py. This causes zipapps to fail, since the call to meson.main() fails. Copying the invocation from meson.py fixes this issue. Additionally, add a test to run_meson_command_tests.py that builds a zipapp from the source and attempts executing this zipapp with --help to ensure that the resulting zipapp is properly executable.
-rw-r--r--__main__.py4
-rwxr-xr-xrun_meson_command_tests.py9
2 files changed, 11 insertions, 2 deletions
diff --git a/__main__.py b/__main__.py
index c412e37..27cd4c0 100644
--- a/__main__.py
+++ b/__main__.py
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import meson
+from mesonbuild import mesonmain
import sys
-sys.exit(meson.main())
+sys.exit(mesonmain.main())
diff --git a/run_meson_command_tests.py b/run_meson_command_tests.py
index 6efd911..cd220de 100755
--- a/run_meson_command_tests.py
+++ b/run_meson_command_tests.py
@@ -18,6 +18,7 @@ import os
import tempfile
import unittest
import subprocess
+import zipapp
from pathlib import Path
from mesonbuild.mesonlib import windows_proof_rmtree, python_command, is_windows
@@ -182,5 +183,13 @@ class CommandTests(unittest.TestCase):
def test_meson_exe_windows(self):
raise unittest.SkipTest('NOT IMPLEMENTED')
+ def test_meson_zipapp(self):
+ if is_windows():
+ raise unittest.SkipTest('NOT IMPLEMENTED')
+ source = Path(__file__).resolve().parent.as_posix()
+ target = self.tmpdir / 'meson.pyz'
+ zipapp.create_archive(source=source, target=target, interpreter=python_command[0], main=None)
+ self._run([target.as_posix(), '--help'])
+
if __name__ == '__main__':
unittest.main(buffer=True)