Skip to content

Commit

Permalink
[MDB-26086]: Introduce conditional python3 dependency for different d…
Browse files Browse the repository at this point in the history
…istributions (#86)
  • Loading branch information
aalexfvk authored Nov 7, 2023
1 parent 05b47a8 commit e126f91
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ clean-pycache:
.PHONY: install
install:
@echo "Installing into $(INSTALL_DIR)"
python3.6 -m venv $(INSTALL_DIR)
$(PYTHON) -m venv $(INSTALL_DIR)
$(INSTALL_DIR)/bin/pip install -r requirements.txt
$(INSTALL_DIR)/bin/pip install .
mkdir -p $(DESTDIR)/usr/bin/
Expand Down
4 changes: 2 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ Source: ch-backup
Section: database
Priority: optional
Maintainer: Yandex LLC
Build-Depends: debhelper (>= 8.0.0), python3.6, python3.6-venv, python3-pip
Build-Depends: debhelper (>= 8.0.0), python3 (>= 3.6), python3-venv, python3-pip
Standards-Version: 3.9.4
Homepage: https://github.com/yandex/ch-backup
Vcs-Browser: https://github.com/yandex/ch-backup.git
Vcs-Git: git://github.com:yandex/ch-backup.git

Package: ch-backup
Architecture: any
Depends: python3.6
Depends: ${python:Depends}
Description: Backup tool for ClickHouse DBMS.
15 changes: 15 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
#!/usr/bin/make -f
# -*- makefile -*-

PYTHON_MAJOR := $(shell $(PYTHON) -c 'import sys; print(sys.version_info[0])')
PYTHON_MINOR := $(shell $(PYTHON) -c 'import sys; print(sys.version_info[1])')

PYTHON_FROM := $(PYTHON_MAJOR).$(PYTHON_MINOR)
PYTHON_TO := $(PYTHON_MAJOR).$(shell echo $$(( $(PYTHON_MINOR) + 1 )))

# Use conditional python3 dependency because package for Bionic requires python3.6,
# but package for Jammy requires python3.10.
# All this is due to the fact that we put the entire virtual environment in a deb package
# and that venv links to the system python
SUBSTVARS := -Vpython:Depends="python3 (>= $(PYTHON_FROM)), python3 (<< $(PYTHON_TO))"

%:
dh $@

override_dh_gencontrol:
dh_gencontrol -- $(SUBSTVARS)

override_dh_auto_clean:

override_dh_strip:
Expand Down

0 comments on commit e126f91

Please sign in to comment.