Use `${PYTHON_EXECUTABLE}` instead of `py` in cmake (#7042)
* Emit include for bfbs-gen-embed * Use python3 explicitly * bump min python version to 3.6 * Sort find_package for python * try casting Path to string * cast WindowsPath to string to please CI * stringify the wrong thing * another stringify path
This commit is contained in:
parent
028f0fde62
commit
dbbaeac85c
|
@ -526,16 +526,16 @@ function(compile_flatbuffers_schema_to_embedded_binary SRC_FBS OPT)
|
|||
register_generated_output(${GEN_BFBS_HEADER})
|
||||
endfunction()
|
||||
|
||||
# Look if we have python 3 installed so that we can run the generate code python
|
||||
# script after flatc is built.
|
||||
find_package(PythonInterp 3)
|
||||
# Look if we have python 3.5 installed so that we can run the generate code
|
||||
# python script after flatc is built.
|
||||
find_package(PythonInterp 3.5)
|
||||
|
||||
if(PYTHONINTERP_FOUND AND
|
||||
# Skip doing this if the MSVC version is below VS 12.
|
||||
# https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
|
||||
(NOT MSVC OR MSVC_VERSION GREATER 1800))
|
||||
if(MSVC)
|
||||
set(GENERATION_SCRIPT py scripts/generate_code.py)
|
||||
set(GENERATION_SCRIPT ${PYTHON_EXECUTABLE} scripts/generate_code.py)
|
||||
else()
|
||||
set(GENERATION_SCRIPT scripts/generate_code.py)
|
||||
endif()
|
||||
|
|
|
@ -74,7 +74,7 @@ def flatc(
|
|||
cmd += [schema] if isinstance(schema, str) else schema
|
||||
if data:
|
||||
cmd += [data] if isinstance(data, str) else data
|
||||
result = subprocess.run(cmd, cwd=cwd, check=True)
|
||||
result = subprocess.run(cmd, cwd=str(cwd), check=True)
|
||||
|
||||
|
||||
# Glob a pattern relative to file path
|
||||
|
@ -360,7 +360,7 @@ assert (
|
|||
new_monster_file.exists()
|
||||
), "filename suffix option did not produce a file"
|
||||
assert filecmp.cmp(
|
||||
orig_monster_file, new_monster_file
|
||||
str(orig_monster_file), str(new_monster_file)
|
||||
), "filename suffix option did not produce identical results"
|
||||
new_monster_file.unlink()
|
||||
|
||||
|
@ -409,6 +409,6 @@ new_reflection_file = Path(reflection_path, temp_dir, "reflection_generated.h")
|
|||
original_reflection_file = Path(
|
||||
root_path, "include/flatbuffers/reflection_generated.h"
|
||||
)
|
||||
if not filecmp.cmp(new_reflection_file, original_reflection_file):
|
||||
shutil.move(new_reflection_file, original_reflection_file)
|
||||
shutil.rmtree(Path(reflection_path, temp_dir))
|
||||
if not filecmp.cmp(str(new_reflection_file), str(original_reflection_file)):
|
||||
shutil.move(str(new_reflection_file), str(original_reflection_file))
|
||||
shutil.rmtree(str(Path(reflection_path, temp_dir)))
|
||||
|
|
Loading…
Reference in New Issue