| 1 | #!/usr/bin/env python3 |
| 2 | |
| 3 | import sysscip-python python python-stdlib 3.11 sys/__init__:, osscip-python python python-stdlib 3.11 os/__init__:, subprocessscip-python python python-stdlib 3.11 subprocess/__init__: |
| 4 | |
| 5 | def generatescip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/generate().(infilescip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/generate().(infile), outfilescip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/generate().(outfile), fallbackscip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/generate().(fallback)): |
| 6 | workdir = osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..splitscip-python python python-stdlib 3.11 posixpath/split().(infilescip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/generate().(infile))[0] |
| 7 | if workdir == '': |
| 8 | workdir = '.' |
| 9 | try: |
| 10 | version = subprocessscip-python python python-stdlib 3.11 subprocess/__init__:.check_outputscip-python python python-stdlib 3.11 subprocess/check_output().(['git', 'describe'], cwdscip-python python python-stdlib 3.11 subprocess/check_output().(cwd)=workdir).decodescip-python python python-stdlib 3.11 builtins/bytes#decode().().stripscip-python python python-stdlib 3.11 builtins/str#strip().() |
| 11 | except (subprocessscip-python python python-stdlib 3.11 subprocess/__init__:.CalledProcessErrorscip-python python python-stdlib 3.11 subprocess/CalledProcessError#, OSErrorscip-python python python-stdlib 3.11 builtins/OSError#, UnicodeDecodeErrorscip-python python python-stdlib 3.11 builtins/UnicodeDecodeError#): |
| 12 | version = fallbackscip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/generate().(fallback) |
| 13 | with openscip-python python python-stdlib 3.11 builtins/open().(infilescip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/generate().(infile)) as f: |
| 14 | newdata = f.readscip-python python python-stdlib 3.11 io/TextIOBase#read().().replacescip-python python python-stdlib 3.11 builtins/str#replace().('@VERSION@', version) |
| 15 | try: |
| 16 | with openscip-python python python-stdlib 3.11 builtins/open().(outfilescip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/generate().(outfile)) as f: |
| 17 | olddata = f.readscip-python python python-stdlib 3.11 io/TextIOBase#read().() |
| 18 | if olddata == newdata: |
| 19 | return |
| 20 | except OSErrorscip-python python python-stdlib 3.11 builtins/OSError#: |
| 21 | pass |
| 22 | with openscip-python python python-stdlib 3.11 builtins/open().(outfilescip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/generate().(outfile), 'w') as f: |
| 23 | f.writescip-python python python-stdlib 3.11 io/TextIOBase#write().(newdata) |
| 24 | |
| 25 | if __name__scip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/ == '__main__': |
| 26 | infilescip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/infile. = sysscip-python python python-stdlib 3.11 sys/__init__:.argvscip-python python python-stdlib 3.11 sys/argv.argv.[1] |
| 27 | outfilescip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/outfile. = sysscip-python python python-stdlib 3.11 sys/__init__:.argvscip-python python python-stdlib 3.11 sys/argv.argv.[2] |
| 28 | fallbackscip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/fallback. = sysscip-python python python-stdlib 3.11 sys/__init__:.argvscip-python python python-stdlib 3.11 sys/argv.argv.[3] |
| 29 | generatescip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/generate().(infilescip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/infile., outfilescip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/outfile., fallbackscip-python python meson 1.11.1 `test cases.common.65 build always.version_gen`/fallback.) |