diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-10-25 11:56:13 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-10-25 11:56:13 -0400 |
commit | 2e3e9748d46fef423bae36bd4f5d94e38f66f85c (patch) | |
tree | bc07a05802a2e0d44826324803b11505a0830074 | |
parent | 718cefefcdcbd916bcd24f9d2d8f0d927cbc6342 (diff) | |
download | python-systemd-2e3e9748d46fef423bae36bd4f5d94e38f66f85c.tar.gz |
build-sys: replace loop with list comprehension
-rw-r--r-- | setup.py | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -7,11 +7,9 @@ from subprocess import Popen, PIPE, check_output class build_ext_generate_id128_header(build_ext): def run(self): if not self.dry_run and not os.path.exists("systemd/id128-constants.h"): - constants = [] - with open("/usr/include/systemd/sd-messages.h") as f: - for line in f: - if line.startswith('#define SD'): - constants.append(line.split()[1]) + constants = [line.split()[1] + for line in open("/usr/include/systemd/sd-messages.h") + if line.startswith('#define SD_MESSAGE_')] with open("systemd/id128-constants.h", "w") as f: for c in constants: |