mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
build: Install to datadir
Install the python module to the data directory, not the python install directory that meson gives us. Then, in the main script, try to find the module and add it to the path by assuming the script is installed to (prefix)/bin. Hopefully this will fix the ModuleNotFound errors.
This commit is contained in:
parent
cebd9ecadc
commit
6f4d458855
3 changed files with 11 additions and 1 deletions
|
@ -19,6 +19,13 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
from blueprintcompiler import main
|
from blueprintcompiler import main
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -26,7 +26,7 @@ install_data(
|
||||||
meson.override_find_program('blueprint-compiler', find_program('blueprint-compiler.py'))
|
meson.override_find_program('blueprint-compiler', find_program('blueprint-compiler.py'))
|
||||||
|
|
||||||
if not meson.is_subproject()
|
if not meson.is_subproject()
|
||||||
install_subdir('blueprintcompiler', install_dir: py.get_install_dir())
|
install_subdir('blueprintcompiler', install_dir: datadir / 'blueprint-compiler')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
subdir('tests')
|
subdir('tests')
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
import os, sys
|
||||||
from pythonfuzz.main import PythonFuzz
|
from pythonfuzz.main import PythonFuzz
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
||||||
|
|
||||||
from blueprintcompiler import tokenizer, parser, decompiler
|
from blueprintcompiler import tokenizer, parser, decompiler
|
||||||
from blueprintcompiler.completions import complete
|
from blueprintcompiler.completions import complete
|
||||||
from blueprintcompiler.errors import PrintableError, MultipleErrors, CompileError, CompilerBugError
|
from blueprintcompiler.errors import PrintableError, MultipleErrors, CompileError, CompilerBugError
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue