Skip to content

Commit

Permalink
[fix] Try to find data directory beside lib directory first
Browse files Browse the repository at this point in the history
  • Loading branch information
csordasmarton committed Aug 11, 2021
1 parent 9c0ed83 commit 367251b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
15 changes: 13 additions & 2 deletions codechecker_common/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,25 @@ def get_data_files_dir_path():
# If it's not an internal package (pypi package), try to find the data
# directory.
import sysconfig
data_dir_paths = set(sysconfig.get_path("data", s)
for s in sysconfig.get_scheme_names())
data_dir_paths = [
# Try to find the data directory beside the lib directory.
# E.g.: /usr/local/lib/python3.8/dist-packages/codechecker_common/*.py
os.path.abspath(os.path.join(__file__, *[os.path.pardir] * 5)),

# Automatically try to find data directory if it can be found on other
# places.
*set(sysconfig.get_path("data", s)
for s in sysconfig.get_scheme_names())]

for dir_path in data_dir_paths:
data_dir_path = os.path.join(dir_path, 'share', 'codechecker')
if os.path.exists(data_dir_path):
return data_dir_path

print("Failed to get CodeChecker data files directory path in: ",
data_dir_paths)
sys.exit(1)


def main():
"""
Expand Down
12 changes: 6 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,19 +205,19 @@ Useful tools that can also be used outside CodeChecker.

# Install guide

## Install CodeChecker via pip
## Install CodeChecker via `pip`
CodeChecker is available on the [pypi](https://pypi.org/project/codechecker/)
and can be install with the following command:
and can be installed with the following command:
```sh
pip3 install codechecker
```

**Note:** this package can be installed on `Linux`, `OSX` and `Windows`
systems where `pip3` command is available. On `OSX` `intercept-build` must be
installed for logging (`CodeChecker log`). On `Windows` system the logging
feature is not available.
systems where `pip3` command is available. On `OSX`, `intercept-build` must be
installed for logging (`CodeChecker log`). On `Windows`, logging is not
available.

## Installing CodeChecker via Snap package manager
## Installing CodeChecker via `Snap package manager`
CodeChecker is available on the [Snap Store](https://snapcraft.io/codechecker)
and can be installed with the following command:
```sh
Expand Down

0 comments on commit 367251b

Please sign in to comment.