Commit graph

3 commits

Author SHA1 Message Date
Emmanuele Bassi
2be68fb4e0 build: Turn version.py into idiomatic Python
While it's possible to write C code in Python, it's better to actually
write Python code in Python.

Use regular expressions, instead of counting characters, to allow a
little bit more leeway when editing the cairo-version.h header file.

Use a context manager to handle the lifetime of a file object.

Use f-strings instead of the obsolete format() method.
2023-02-02 08:37:28 +01:00
Tim-Philipp Müller
9732f4e80f meson: use encoding=utf-8 when reading/writing files in helper script
Fixes errors such as

Traceback (most recent call last):
  File "C:\Users\...\cairo\test\make-cairo-test-constructors.py", line 19, in <module>
    for l in f.readlines():
  File "c:\python39\lib\encodings\cp1253.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 6694: character maps to <undefined>

on non-English-language Windows locales/installations.
2021-02-23 23:42:11 +00:00
Tim-Philipp Müller
c3e48e63a2 meson: extract meson version from cairo-version.h
Same as autotools does. Arguably it would be better to do
it the other way round and generate cairo-version.h from
the version in meson.build or configure.ac but for now
let's do this so it's at least in sync with the autotools
build and only one file has to be edited for releases.
2020-10-21 11:45:54 +00:00