Skip to content

Commit

Permalink
Update for libcamera v0.2.0+rpt20240215
Browse files Browse the repository at this point in the history
  • Loading branch information
will-v-pi committed Feb 23, 2024
1 parent ba23108 commit 6330d39
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build
check-version
libcamera
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down
Binary file removed check-version
Binary file not shown.
11 changes: 11 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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]
Expand Down
59 changes: 59 additions & 0 deletions update-version.py
Original file line number Diff line number Diff line change
@@ -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"))

0 comments on commit 6330d39

Please sign in to comment.