mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
parent
6f4d458855
commit
65691dfac6
4 changed files with 27 additions and 10 deletions
|
@ -26,7 +26,13 @@ dirname = os.path.join(os.path.dirname(os.path.dirname(__file__)), "share", "blu
|
||||||
if os.path.isdir(os.path.join(dirname, "blueprintcompiler")):
|
if os.path.isdir(os.path.join(dirname, "blueprintcompiler")):
|
||||||
sys.path.insert(0, dirname)
|
sys.path.insert(0, dirname)
|
||||||
|
|
||||||
|
# Get the configured (or, if running from source, not configured) version number
|
||||||
|
version = "@VERSION@"
|
||||||
|
|
||||||
|
def literal(key):
|
||||||
|
return "@" + key + "@"
|
||||||
|
|
||||||
from blueprintcompiler import main
|
from blueprintcompiler import main
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main.main()
|
main.main("uninstalled" if version == literal("VERSION") else version)
|
||||||
|
|
|
@ -151,6 +151,8 @@ class LanguageServer:
|
||||||
|
|
||||||
@command("initialize")
|
@command("initialize")
|
||||||
def initialize(self, id, params):
|
def initialize(self, id, params):
|
||||||
|
from . import main
|
||||||
|
|
||||||
self.client_capabilities = params.get("capabilities")
|
self.client_capabilities = params.get("capabilities")
|
||||||
self._send_response(id, {
|
self._send_response(id, {
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
|
@ -167,7 +169,11 @@ class LanguageServer:
|
||||||
"completionProvider": {},
|
"completionProvider": {},
|
||||||
"codeActionProvider": {},
|
"codeActionProvider": {},
|
||||||
"hoverProvider": True,
|
"hoverProvider": True,
|
||||||
}
|
},
|
||||||
|
"serverInfo": {
|
||||||
|
"name": "Blueprint",
|
||||||
|
"version": main.VERSION,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@command("textDocument/didOpen")
|
@command("textDocument/didOpen")
|
||||||
|
|
|
@ -27,9 +27,7 @@ from . import parser, tokenizer, decompiler, interactive_port
|
||||||
from .utils import Colors
|
from .utils import Colors
|
||||||
from .xml_emitter import XmlEmitter
|
from .xml_emitter import XmlEmitter
|
||||||
|
|
||||||
|
VERSION = "uninstalled"
|
||||||
VERSION = "0.1.0"
|
|
||||||
|
|
||||||
|
|
||||||
class BlueprintApp:
|
class BlueprintApp:
|
||||||
def main(self):
|
def main(self):
|
||||||
|
@ -53,6 +51,8 @@ class BlueprintApp:
|
||||||
|
|
||||||
self.add_subcommand("help", "Show this message", self.cmd_help)
|
self.add_subcommand("help", "Show this message", self.cmd_help)
|
||||||
|
|
||||||
|
self.parser.add_argument("--version", action="version", version=VERSION)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts = self.parser.parse_args()
|
opts = self.parser.parse_args()
|
||||||
opts.func(opts)
|
opts.func(opts)
|
||||||
|
@ -144,5 +144,7 @@ class BlueprintApp:
|
||||||
return ast.generate(), warnings
|
return ast.generate(), warnings
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main(version):
|
||||||
|
global VERSION
|
||||||
|
VERSION = version
|
||||||
BlueprintApp().main()
|
BlueprintApp().main()
|
||||||
|
|
11
meson.build
11
meson.build
|
@ -17,13 +17,16 @@ configure_file(
|
||||||
install_dir: join_paths(datadir, 'pkgconfig'),
|
install_dir: join_paths(datadir, 'pkgconfig'),
|
||||||
)
|
)
|
||||||
|
|
||||||
install_data(
|
blueprint_compiler = configure_file(
|
||||||
'blueprint-compiler.py',
|
input: 'blueprint-compiler.py',
|
||||||
|
output: 'blueprint-compiler',
|
||||||
|
configuration: {
|
||||||
|
'VERSION': meson.project_version(),
|
||||||
|
},
|
||||||
install_dir: get_option('bindir'),
|
install_dir: get_option('bindir'),
|
||||||
rename: 'blueprint-compiler',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
meson.override_find_program('blueprint-compiler', find_program('blueprint-compiler.py'))
|
meson.override_find_program('blueprint-compiler', blueprint_compiler)
|
||||||
|
|
||||||
if not meson.is_subproject()
|
if not meson.is_subproject()
|
||||||
install_subdir('blueprintcompiler', install_dir: datadir / 'blueprint-compiler')
|
install_subdir('blueprintcompiler', install_dir: datadir / 'blueprint-compiler')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue