mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 06:30:27 +03:00 
			
		
		
		
	Merge branch 'replace-deprecated-pkg_resources' into 'master'
support Python 3.13 See merge request fdroid/fdroidserver!1576
This commit is contained in:
		
						commit
						36fafaf2cc
					
				
					 3 changed files with 40 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -28,6 +28,7 @@ import os
 | 
			
		|||
import re
 | 
			
		||||
import ruamel.yaml
 | 
			
		||||
import shutil
 | 
			
		||||
import sys
 | 
			
		||||
import tempfile
 | 
			
		||||
import urllib.parse
 | 
			
		||||
import zipfile
 | 
			
		||||
| 
						 | 
				
			
			@ -1309,6 +1310,29 @@ def make_v0(apps, apks, repodir, repodict, requestsdict, fdroid_signing_key_fing
 | 
			
		|||
                        os.remove(siglinkname)
 | 
			
		||||
                    os.symlink(sigfile_path, siglinkname)
 | 
			
		||||
 | 
			
		||||
    if sys.version_info.minor >= 13:
 | 
			
		||||
        # Python 3.13 changed minidom so it no longer converts " to an XML entity.
 | 
			
		||||
        # https://github.com/python/cpython/commit/154477be722ae5c4e18d22d0860e284006b09c4f
 | 
			
		||||
        # This just puts back the previous implementation, with black code format.
 | 
			
		||||
        import inspect
 | 
			
		||||
        import xml.dom.minidom
 | 
			
		||||
 | 
			
		||||
        def _write_data(writer, text, attr):  # pylint: disable=unused-argument
 | 
			
		||||
            if text:
 | 
			
		||||
                text = (
 | 
			
		||||
                    text.replace('&', '&')
 | 
			
		||||
                    .replace('<', '<')
 | 
			
		||||
                    .replace('"', '"')
 | 
			
		||||
                    .replace('>', '>')
 | 
			
		||||
                )
 | 
			
		||||
            writer.write(text)
 | 
			
		||||
 | 
			
		||||
        argnames = tuple(inspect.signature(xml.dom.minidom._write_data).parameters)
 | 
			
		||||
        if argnames == ('writer', 'text', 'attr'):
 | 
			
		||||
            xml.dom.minidom._write_data = _write_data
 | 
			
		||||
        else:
 | 
			
		||||
            logging.warning('Failed to monkey patch minidom for index.xml support!')
 | 
			
		||||
 | 
			
		||||
    if common.options.pretty:
 | 
			
		||||
        output = doc.toprettyxml(encoding='utf-8')
 | 
			
		||||
    else:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										16
									
								
								setup.py
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								setup.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -116,8 +116,13 @@ setup(
 | 
			
		|||
    # Some requires are only needed for very limited cases:
 | 
			
		||||
    # * biplist is only used for parsing Apple .ipa files
 | 
			
		||||
    # * pycountry is only for linting config/mirrors.yml
 | 
			
		||||
    # * python-magic is preferred when libmagic is available, but its not in pypi.org
 | 
			
		||||
    extras_require={
 | 
			
		||||
        'optional': ['biplist', 'pycountry'],
 | 
			
		||||
        'optional': [
 | 
			
		||||
            'biplist',
 | 
			
		||||
            'pycountry',
 | 
			
		||||
            'python-magic',
 | 
			
		||||
        ],
 | 
			
		||||
        'test': ['pyjks', 'html5print'],
 | 
			
		||||
        'docs': [
 | 
			
		||||
            'sphinx',
 | 
			
		||||
| 
						 | 
				
			
			@ -127,7 +132,7 @@ setup(
 | 
			
		|||
        ],
 | 
			
		||||
    },
 | 
			
		||||
    classifiers=[
 | 
			
		||||
        'Development Status :: 4 - Beta',
 | 
			
		||||
        'Development Status :: 5 - Production/Stable',
 | 
			
		||||
        'Intended Audience :: Developers',
 | 
			
		||||
        'Intended Audience :: Information Technology',
 | 
			
		||||
        'Intended Audience :: System Administrators',
 | 
			
		||||
| 
						 | 
				
			
			@ -136,6 +141,13 @@ setup(
 | 
			
		|||
        'Operating System :: POSIX',
 | 
			
		||||
        'Operating System :: MacOS :: MacOS X',
 | 
			
		||||
        'Operating System :: Unix',
 | 
			
		||||
        'Programming Language :: Python :: 3',
 | 
			
		||||
        'Programming Language :: Python :: 3.9',
 | 
			
		||||
        "Programming Language :: Python :: 3.10",
 | 
			
		||||
        "Programming Language :: Python :: 3.11",
 | 
			
		||||
        "Programming Language :: Python :: 3.12",
 | 
			
		||||
        "Programming Language :: Python :: 3.13",
 | 
			
		||||
        'Programming Language :: Python :: 3 :: Only',
 | 
			
		||||
        'Topic :: Utilities',
 | 
			
		||||
    ],
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2394,11 +2394,9 @@ class CommonTest(unittest.TestCase):
 | 
			
		|||
    def test_auto_install_ndk_mock_dl(self):
 | 
			
		||||
        """Test NDK installs by actually calling sdkmanager"""
 | 
			
		||||
        import sdkmanager
 | 
			
		||||
        import pkg_resources
 | 
			
		||||
        import importlib.metadata
 | 
			
		||||
 | 
			
		||||
        sdkmanager_version = LooseVersion(
 | 
			
		||||
            pkg_resources.get_distribution('sdkmanager').version
 | 
			
		||||
        )
 | 
			
		||||
        sdkmanager_version = LooseVersion(importlib.metadata.version('sdkmanager'))
 | 
			
		||||
        if sdkmanager_version < LooseVersion('0.6.4'):
 | 
			
		||||
            raise unittest.SkipTest('needs fdroid sdkmanager >= 0.6.4')
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue