summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-10-01 22:06:54 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2016-10-01 22:06:54 +0300
commit08e43e8bfd150252b3e05ff62ee25cdf0e519f20 (patch)
tree14e44819fbc6850340a8e90040044cc9e80fc7f7
parent207cdf28760d5fc51345e89604cc9a4d05960604 (diff)
downloadmeson-08e43e8bfd150252b3e05ff62ee25cdf0e519f20.tar.gz
Revert #830 because it broke the case when the main script is not in path.
-rwxr-xr-xmeson.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/meson.py b/meson.py
index 7f2c49dba..bc448ad85 100755
--- a/meson.py
+++ b/meson.py
@@ -17,4 +17,18 @@
from mesonbuild import mesonmain
import sys, os
-sys.exit(mesonmain.run(sys.argv[0], sys.argv[1:]))
+def main():
+ thisfile = __file__
+ if not os.path.isabs(thisfile):
+ thisfile = os.path.normpath(os.path.join(os.getcwd(), thisfile))
+ if __package__ == '':
+ thisfile = os.path.dirname(thisfile)
+
+ # The first argument *must* be an absolute path because
+ # the user may have launched the program from a dir
+ # that is not in path.
+ sys.exit(mesonmain.run(thisfile, sys.argv[1:]))
+
+if __name__ == '__main__':
+ main()
+