Skip to content

Commit

Permalink
setup: Do not fail when pkg-config is missing
Browse files Browse the repository at this point in the history
```
$ ./setup.py --help
Traceback (most recent call last):
  File "./setup.py", line 106, in <module>
    systemd_unit_dir = subprocess.check_output(
  File "/usr/lib/python3.10/subprocess.py", line 421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.10/subprocess.py", line 503, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pkg-config'
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
  • Loading branch information
bdrung committed Oct 24, 2023
1 parent d20d68b commit 4f7e791
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
apt-get update
&& apt-get install --no-install-recommends --yes
bash binutils default-jdk-headless dpkg-dev gcc gdb iputils-ping kmod
libc6-dev pkg-config python3 python3-apt python3-distutils-extra
libc6-dev python3 python3-apt python3-distutils-extra
python3-launchpadlib python3-psutil python3-pytest python3-pytest-cov
python3-requests python3-setuptools python3-systemd valgrind
- name: Build Java subdir
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def run(self):
systemd_tmpfiles_dir = subprocess.check_output(
["pkg-config", "--variable=tmpfilesdir", "systemd"], universal_newlines=True
).strip()
except subprocess.CalledProcessError:
except (FileNotFoundError, subprocess.CalledProcessError):

Check warning on line 113 in setup.py

View check run for this annotation

Codecov / codecov/patch

setup.py#L113

Added line #L113 was not covered by tests
# hardcoded fallback path
systemd_unit_dir = "/lib/systemd/system"
systemd_tmpfiles_dir = "/usr/lib/tmpfiles.d"
Expand Down

0 comments on commit 4f7e791

Please sign in to comment.