Skip to content

Commit 2e3e974

Browse files
committed
build-sys: replace loop with list comprehension
1 parent 718cefe commit 2e3e974

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

setup.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
class build_ext_generate_id128_header(build_ext):
88
def run(self):
99
if not self.dry_run and not os.path.exists("systemd/id128-constants.h"):
10-
constants = []
11-
with open("/usr/include/systemd/sd-messages.h") as f:
12-
for line in f:
13-
if line.startswith('#define SD'):
14-
constants.append(line.split()[1])
10+
constants = [line.split()[1]
11+
for line in open("/usr/include/systemd/sd-messages.h")
12+
if line.startswith('#define SD_MESSAGE_')]
1513

1614
with open("systemd/id128-constants.h", "w") as f:
1715
for c in constants:

0 commit comments

Comments
 (0)