-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
51 lines (40 loc) · 1.63 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import logging
import re
import subprocess
from setuptools import setup
def get_python_apt_version() -> str:
proc = subprocess.Popen(
['dpkg-query', '-W', '-f', '${Version}', 'python3-apt'], stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
out, _ = proc.communicate()
if proc.returncode == 0:
version = out.decode('utf-8').strip()
if version:
version = clean_version(version)
logging.info(f'Using python-apt version {version}')
if version == '2.6.0':
version = 'a1ecf380cb6688a239c30f2786424f864e9b32af'
return version
logging.error(
'Failed to get python-apt version. Please install python3-apt and python-apt-dev debian packages:\n'
'"sudo apt install -y python3-apt python-apt-dev"'
)
exit(1)
def clean_version(version: str) -> str:
match = re.match(r'(\d+\.\d+\.\d+)', version)
return match.group(1) if match else version
setup(
name='debian-package-installer',
version='1.1.1',
description='Debian package installer',
author='Ferenc Nandor Janky & Attila Gombos',
author_email='[email protected]',
packages=['package_installer'],
scripts=['bin/debian-package-installer.py'],
package_data={'package_installer': ['py.typed']},
install_requires=[
f'python-apt@git+https://salsa.debian.org/apt-team/python-apt@{get_python_apt_version()}',
'python-context-logger@git+https://github.com/EffectiveRange/python-context-logger.git@latest',
'debian-package-downloader@git+https://github.com/EffectiveRange/debian-package-downloader.git@latest',
],
)