mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
build: Set the module path in the build
Instead of trying to find the module by traversing from the executable, have meson hardcode the path. I *think* this is a little less fragile.
This commit is contained in:
parent
75475d1a45
commit
e78fae4f12
2 changed files with 26 additions and 18 deletions
|
@ -21,18 +21,19 @@
|
|||
|
||||
import os, sys
|
||||
|
||||
# Try to find the python module, assuming the current file is installed to (prefix)/bin
|
||||
dirname = os.path.join(os.path.dirname(os.path.dirname(__file__)), "share", "blueprint-compiler")
|
||||
if os.path.isdir(os.path.join(dirname, "blueprintcompiler")):
|
||||
sys.path.insert(0, dirname)
|
||||
|
||||
# Get the configured (or, if running from source, not configured) version number
|
||||
# These variables should be set by meson. If they aren't, we're running
|
||||
# uninstalled, and we might have to guess some values.
|
||||
version = "@VERSION@"
|
||||
module_path = "@MODULE_PATH@"
|
||||
libdir = "@LIBDIR@"
|
||||
|
||||
def literal(key):
|
||||
return "@" + key + "@"
|
||||
if version == "\u0040VERSION@":
|
||||
version = "uninstalled"
|
||||
else:
|
||||
# If Meson set the configuration values, insert the module path it set
|
||||
sys.path.insert(0, module_path)
|
||||
|
||||
from blueprintcompiler import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main.main("uninstalled" if version == literal("VERSION") else version)
|
||||
main.main(version)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue