Skip to content

Commit 4f882af

Browse files
committed
Merge branch 'topic/impactdbpythonpath' into 'master'
Let the devenv set the PYTHONPATH (either ancr or anod) Closes #544 See merge request eng/libadalang/langkit-query-language!527
2 parents 042a9d9 + 1d6880b commit 4f882af

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ NPM_INSTALL_CACHE=true
1414
NPMRC=
1515
BUILD_DIR=/undefined
1616
LKQL_DIR=$(BUILD_DIR)/lkql
17-
# Default impact-db directory as set in an ancr devenv
18-
IMPACTDB_DIR=$(ANCR_ROOT_DIR_POSIX)/src/impact-db
1917
GPRBUILD=gprbuild -j$(PROCS) -p -XBUILD_MODE=$(BUILD_MODE)
2018
GPRINSTALL=gprinstall --prefix=$(PREFIX) -p -XBUILD_MODE=$(BUILD_MODE)
2119
BUILD_FOR_JIT=false
@@ -43,7 +41,7 @@ doc:
4341
cd lkql_checker/doc && make generate html-all
4442

4543
impacts:
46-
[ -f "$(KP_JSON)" ] || PYTHONPATH="$(IMPACTDB_DIR)" "$(PYTHON)" "./utils/impact-db_impacts_gen.py" "$(IMPACTDB_DIR)"
44+
[ -f "$(KP_JSON)" ] || "$(PYTHON)" "./utils/impact-db_impacts_gen.py"
4745

4846
format:
4947
gnatformat -P lkql_checker/gnatcheck.gpr --no-subprojects

utils/impact-db_impacts_gen.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
#!/usr/bin/env python3
22

3-
# This script should be run at the top level of the langkit-query-language with
4-
# PYTHONPATH set to the impact-db repository path. The impact-db repository path
5-
# should also be passed as first argument:
6-
#
7-
# $ PYTHONPATH=/path/to/impact-db ./impact-db_impacts_gen.py /path/to/impact-db
3+
# This script should be run at the top level of the langkit-query-language.
84

95
import glob
6+
import inspect
107
import json
11-
import sys
8+
import os
129
from collections import OrderedDict
1310
from pathlib import Path
1411
from impactdb import db
1512

16-
impactdb_dir = sys.argv[1]
1713
res = {}
1814

1915

@@ -27,7 +23,8 @@ def format_name(name: str) -> str:
2723

2824

2925
def list_impacts(issues: [str]) -> None:
30-
entries = [e for e in db.load(impactdb_dir + "/entries") if e.type == "kp"]
26+
entries = os.path.join(os.path.dirname(inspect.getfile(db)), "..", "entries")
27+
entries = [e for e in db.load(entries) if e.type == "kp"]
3128
for e in entries:
3229
if e.name in issues:
3330
res.update({format_name(e.name): format_impacts(e.impacts)})

0 commit comments

Comments
 (0)