mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-20 17:30:07 +01:00
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.
31 lines
989 B
Python
Executable file
31 lines
989 B
Python
Executable file
#!/usr/bin/env python3
|
|
#
|
|
# cairo version.py
|
|
#
|
|
# Extracts the version from cairo-version.h for the meson build files.
|
|
#
|
|
import os
|
|
import sys
|
|
|
|
if __name__ == '__main__':
|
|
srcroot = os.path.dirname(__file__)
|
|
|
|
version_major = None
|
|
version_minor = None
|
|
version_micro = None
|
|
|
|
f = open(os.path.join(srcroot, 'src', 'cairo-version.h'), 'r', encoding='utf-8')
|
|
for line in f:
|
|
if line.startswith('#define CAIRO_VERSION_MAJOR '):
|
|
version_major = line[28:].strip()
|
|
if line.startswith('#define CAIRO_VERSION_MINOR '):
|
|
version_minor = line[28:].strip()
|
|
if line.startswith('#define CAIRO_VERSION_MICRO '):
|
|
version_micro = line[28:].strip()
|
|
f.close()
|
|
|
|
if not (version_major and version_minor and version_micro):
|
|
print('ERROR: Could not extract cairo version from cairo-version.h in', srcroot, file=sys.stderr)
|
|
sys.exit(-1)
|
|
|
|
print('{0}.{1}.{2}'.format(version_major, version_minor, version_micro))
|