diff options
| author | Dave Hibberd <d@vehibberd.com> | 2023-10-16 22:15:51 +0100 |
|---|---|---|
| committer | Dave Hibberd <d@vehibberd.com> | 2023-10-17 00:30:57 +0100 |
| commit | 2f4fc9e1cfed7b87b07fab40ab2b0c0bb2ace852 (patch) | |
| tree | d810b67be27f25317091d6c538e9a2dc70d71e51 | |
| parent | 0ef36f83c09202599f919890a1a6fa075b9c329e (diff) | |
Distutils deprecated, use setuptools
| -rw-r--r-- | debian/control | 3 | ||||
| -rw-r--r-- | debian/install | 3 | ||||
| -rw-r--r-- | debian/patches/distutils-migration.patch | 8 | ||||
| -rw-r--r-- | debian/patches/series | 2 | ||||
| -rw-r--r-- | debian/patches/wxui-chirp-share.patch | 131 | ||||
| -rwxr-xr-x | debian/rules | 4 |
6 files changed, 146 insertions, 5 deletions
diff --git a/debian/control b/debian/control index d9df5ad..8a6139e 100644 --- a/debian/control +++ b/debian/control @@ -15,7 +15,8 @@ Build-Depends: python3-serial, python3-six, python3-yattag, - wxpython-tools + wxpython-tools, + python3-setuptools Standards-Version: 4.6.1 Vcs-Browser: https://salsa.debian.org/debian-hamradio-team/chirp Vcs-Git: https://salsa.debian.org/debian-hamradio-team/chirp.git diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..53f7571 --- /dev/null +++ b/debian/install @@ -0,0 +1,3 @@ +chirp/share/chirp.png /usr/share/pixmaps +chirp/share/chirp.desktop /usr/share/applications +chirp/share/* /usr/lib/python3/dist-packages/chirp/share diff --git a/debian/patches/distutils-migration.patch b/debian/patches/distutils-migration.patch new file mode 100644 index 0000000..53dfdd1 --- /dev/null +++ b/debian/patches/distutils-migration.patch @@ -0,0 +1,8 @@ +--- a/setup.py ++++ b/setup.py +@@ -1,4 +1,4 @@ +-from distutils.core import setup ++from setuptools import setup + from setuptools import find_packages + + setup(name='chirp', diff --git a/debian/patches/series b/debian/patches/series index cfe0ff0..07c8c4a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,5 @@ +wxui-chirp-share.patch +distutils-migration.patch 01-fix-manifest.patch 07-disable-reporting.patch 08-disable-incorrect-mime-type diff --git a/debian/patches/wxui-chirp-share.patch b/debian/patches/wxui-chirp-share.patch new file mode 100644 index 0000000..0dd2cd6 --- /dev/null +++ b/debian/patches/wxui-chirp-share.patch @@ -0,0 +1,131 @@ +--- a/chirp/wxui/main.py ++++ b/chirp/wxui/main.py +@@ -373,9 +373,7 @@ + + vbox = wx.BoxSizer(wx.VERTICAL) + self.SetSizer(vbox) +- with importlib_resources.as_file( +- importlib_resources.files('chirp.share') +- .joinpath('welcome_screen.png') ++ with ( os.path.join("/usr/lib/python3/dist-packages/chirp/share/", "welcome_screen.png") + ) as welcome: + bmp = wx.Bitmap(str(welcome)) + width, height = self.GetSize() +@@ -452,9 +450,7 @@ + self.add_tab_panel = wx.Panel(self, pos=(0, 0), size=(600, 600)) + self.add_tab_panel.Hide() + +- with importlib_resources.as_file( +- importlib_resources.files('chirp.share') +- .joinpath('plus-icon.png') ++ with ( os.path.join("/usr/lib/python3/dist-packages/chirp/share/", "plus-icon.png") + ) as icon: + self.add_tab_bm = wx.Bitmap(str(icon), wx.BITMAP_TYPE_ANY) + +@@ -524,11 +520,9 @@ + icon = 'chirp.ico' + else: + icon = 'chirp.png' +- with importlib_resources.as_file( +- importlib_resources.files('chirp.share') +- .joinpath(icon) ++ with ( os.path.join("/usr/lib/python3/dist-packages/chirp/share/", "chirp.png") + ) as path: +- self.SetIcon(wx.Icon(str(path))) ++ self.SetIcon(wx.Icon(path)) + + @property + def current_editorset(self): +--- a/chirp/wxui/__init__.py ++++ b/chirp/wxui/__init__.py +@@ -16,48 +16,48 @@ + CONF = None + + +-def maybe_install_desktop(): +- local = os.path.join(os.path.expanduser('~'), '.local') +- desktop_path = os.path.join(local, 'share', +- 'applications', 'chirp.desktop') +- with importlib_resources.as_file( +- importlib_resources.files('chirp.share') +- .joinpath('chirp.desktop')) as desktop_src: +- with open(desktop_src) as f: +- desktop_content = f.readlines() +- with importlib_resources.as_file( +- importlib_resources.files('chirp.share') +- .joinpath('chirp.ico')) as p: +- icon_path = str(p) +- if os.path.exists(desktop_path): +- return +- +- import wx +- r = wx.MessageBox( +- _('Would you like CHIRP to install a desktop icon for you?'), +- _('Install desktop icon?'), style=wx.YES_NO) +- if r != wx.YES: +- CONF.set_bool('offered_desktop', True, 'state') +- return +- +- os.makedirs(os.path.dirname(desktop_path), exist_ok=True) +- +- # Try to run chirp by name from ~/.local/bin +- exec_path = os.path.join(local, 'bin', 'chirp') +- if not os.path.exists(exec_path): +- # If that doesn't work, then just run it with our python via +- # module, which should always work +- exec_path = '%s -mchirp.wxui' % sys.executable +- with open(desktop_path, 'w') as f: +- for line in desktop_content: +- if line.startswith('Exec'): +- f.write('Exec=%s\n' % exec_path) +- elif line.startswith('Icon'): +- f.write('Icon=%s\n' % icon_path) +- else: +- f.write(line) +- LOG.debug('Wrote %s with exec=%r icon=%r' % ( +- f.name, exec_path, icon_path)) ++# def maybe_install_desktop(): ++# local = os.path.join(os.path.expanduser('~'), '.local') ++# desktop_path = os.path.join(local, 'share', ++# 'applications', 'chirp.desktop') ++# with importlib_resources.as_file( ++# importlib_resources.files('chirp.share') ++# .joinpath('chirp.desktop')) as desktop_src: ++# with open(desktop_src) as f: ++# desktop_content = f.readlines() ++# with importlib_resources.as_file( ++# importlib_resources.files('chirp.share') ++# .joinpath('chirp.ico')) as p: ++# icon_path = str(p) ++# if os.path.exists(desktop_path): ++# return ++# ++# import wx ++# r = wx.MessageBox( ++# _('Would you like CHIRP to install a desktop icon for you?'), ++# _('Install desktop icon?'), style=wx.YES_NO) ++# if r != wx.YES: ++# CONF.set_bool('offered_desktop', True, 'state') ++# return ++# ++# os.makedirs(os.path.dirname(desktop_path), exist_ok=True) ++# ++# # Try to run chirp by name from ~/.local/bin ++# exec_path = os.path.join(local, 'bin', 'chirp') ++# if not os.path.exists(exec_path): ++# # If that doesn't work, then just run it with our python via ++# # module, which should always work ++# exec_path = '%s -mchirp.wxui' % sys.executable ++# with open(desktop_path, 'w') as f: ++# for line in desktop_content: ++# if line.startswith('Exec'): ++# f.write('Exec=%s\n' % exec_path) ++# elif line.startswith('Icon'): ++# f.write('Icon=%s\n' % icon_path) ++# else: ++# f.write(line) ++# LOG.debug('Wrote %s with exec=%r icon=%r' % ( ++# f.name, exec_path, icon_path)) + + + def chirpmain(): diff --git a/debian/rules b/debian/rules index 4fda8dc..200407a 100755 --- a/debian/rules +++ b/debian/rules @@ -5,7 +5,3 @@ override_dh_auto_test: # skip tests until upstream python3 migration is complete - -execute_after_dh_auto_install: - mv debian/chirp/usr/bin/chirpwx.py debian/chirp/usr/bin/chirpw - find debian/chirp/usr/lib -type f -name debug.log -delete |
