-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to generate tz-coords.h as part of the build process. #405
base: master
Are you sure you want to change the base?
Conversation
res = re.search(r"([A-Z]{2})\s([0-9-+]+)\s([\w/_\-]+)\s", line) | ||
code, coords, tz = res.groups() | ||
|
||
res = re.search(r"([+-]{1})([0-9]+)([+-]{1})([0-9]+)", coords) | ||
lat_sign, lat_val, long_sign, long_val = res.groups() | ||
coords, tz = line.split('\t')[1:3] | ||
lat_sign, lat_val, long_sign, long_val = COORDS_RE.search(coords).groups() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file is tab delimited, so simplify the parsing a bit. Also pre-compile the remaining regex.
const char *timezone; | ||
const gchar *timezone; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to match the committed file.
if get_option('generate_tz_coords') | ||
prog_python = find_program('python3') | ||
|
||
tz_coords_h = custom_target( | ||
'tz_coords_h', | ||
input: get_option('zone_tab'), | ||
output: 'tz-coords.h', | ||
command: [prog_python, '@CURRENT_SOURCE_DIR@/generate-tz-header.py', '-i', '@INPUT@', '-o', '@OUTPUT@'] | ||
) | ||
else | ||
tz_coords_h = files('tz-coords.h') | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the generate_tz_coords
option to maintain existing behavior. However, I don't think it would be unreasonable to make this unconditional and delete the pre-generated file.
sources + built_sources, | ||
sources + built_sources + [tz_coords_h], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The brackets seem to be needed for meson <= 0.60.0
WARNING: Project targets '>=0.56.0' but uses feature introduced in '0.60.0': list.<plus>. The right hand operand was not a list.
Allow distros to optionally re-generate the
tz-coords.h
header, on build, with their packaged version of timezone-data/tzdata.I would have updated the csd-night-light code to dynamically parse the zone db, but I haven't done anything significant in C for quite some time.
This is a happy medium, which will make it easier for Gentoo to trigger a rebuild of cinnamon-settings-daemon whenever the zone db gets updated.