diff --git a/.gitignore b/.gitignore index 5415cd1..02e658a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ build +check-version libcamera \ No newline at end of file diff --git a/README.md b/README.md index ccde8e1..c6a95a4 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ If you get the error `This package works with libcamera version ..., but you hav | System and Date | libcamera Reported Version | Pip Package Version | | --------------- | -------------------------- | ------------------- | +| Raspberry Pi Bookworm 15/02/2024 | v0.2.0+46-075b54d5 | 0.1a3 | | Raspberry Pi Bookworm 22/11/2023 | v0.1.0+118-563cd78e | 0.1a2 | ### If that doesn't work... diff --git a/check-version b/check-version deleted file mode 100755 index 275d2ec..0000000 Binary files a/check-version and /dev/null differ diff --git a/meson.build b/meson.build index f8e7918..11c293b 100644 --- a/meson.build +++ b/meson.build @@ -37,6 +37,17 @@ libcamera_private = dependency( py = import('python').find_installation() +controls_files = [ + 'control_ids_core.yaml', + 'control_ids_draft.yaml', + 'control_ids_rpi.yaml', +] + +properties_files = [ + 'property_ids_core.yaml', + 'property_ids_draft.yaml', +] + subdir('libcamera/src/py') message('Using python version @0@ from @1@'.format(py.version(), py.full_path())) diff --git a/pyproject.toml b/pyproject.toml index 91f719e..c643f22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ requires = ['meson-python', 'pyyaml', 'pybind11'] [project] name = 'rpi-libcamera' -version = '0.1a2' +version = '0.1a3' description = 'libcamera python bindings' readme = 'README.md' @@ -14,9 +14,9 @@ Source = "https://github.com/raspberrypi/pylibcamera" [tool.meson-python.args] setup = [ - '-Drevision=v0.1.0+rpt20231122', + '-Drevision=v0.2.0+rpt20240215', '-Drepository=https://github.com/raspberrypi/libcamera.git', - '-Dversion=v0.1.0+118-563cd78e' + '-Dversion=v0.2.0+46-075b54d5' ] [tool.flit.module] diff --git a/update-version.py b/update-version.py new file mode 100644 index 0000000..8ae66d0 --- /dev/null +++ b/update-version.py @@ -0,0 +1,59 @@ +import subprocess + + +# Run build - expected to fail due to different versions +ret = subprocess.run(("python", "-m", "build")) +if ret.returncode == 0: + print("Build did not fail, so must be same version - exit script!!!") + +lines = [] +pyversion_line = None +version_line = None +revision_line = None +with open("pyproject.toml") as f: + for i, line in enumerate(f.readlines()): + if "version = " in line: + pyversion_line = i + elif "-Drevision" in line: + revision_line = i + elif "-Dversion" in line: + version_line = i + lines.append(line) + +new_version = subprocess.check_output("./check-version.sh", text=True).strip() +old_version = lines[version_line][len(" '-Dversion="):-len("'\n")] +print(f"New version is {new_version}, old version was {old_version}") +if old_version == new_version: + print("No change - exit script!!!") +lines[version_line] = f" '-Dversion={new_version}'\n" + +new_revision = subprocess.check_output(["git", "-C", "libcamera", "describe", "--tags", "origin/main"], text=True).strip() +old_revision = lines[revision_line][len(" '-Drevision="):-len("',\n")] +print(f"New revision is {new_revision}, old version was {old_revision}") +if old_revision == new_revision: + print("No change - exit script!!!") +lines[revision_line] = f" '-Drevision={new_revision}',\n" + +old_pyversion = lines[pyversion_line][len("version = '"):-len("'\n")] +new_pyversion = input(f"New pyversion - currently {old_pyversion}: ") +lines[pyversion_line] = f"version = '{new_pyversion}'\n" + +with open("pyproject.toml", "w") as f: + f.writelines(lines) + +lines = [] +table_end_line = None +with open("README.md") as f: + for i, line in enumerate(f.readlines()): + if "| --------------- | -------------------------- | ------------------- |" in line: + table_end_line = i+1 + lines.append(line) + +new_table_line = f"| {input('System and Date (eg Raspberry Pi Bookworm 22/11/2023): ')} | {new_version} | {new_pyversion} |\n" +lines.insert(table_end_line, new_table_line) + +with open("README.md", "w") as f: + f.writelines(lines) + +# Run build - should now succeed +ret = subprocess.run(("python", "-m", "build"))