mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 22:42:29 +03:00
Support both debian's and pypi's python-magic libraries, which are different...
This commit is contained in:
parent
9fb006b567
commit
8e40b59c00
2 changed files with 9 additions and 4 deletions
|
@ -1136,8 +1136,11 @@ def scan_source(build_dir, root_dir, thisbuild):
|
||||||
scanignore = getpaths('scanignore')
|
scanignore = getpaths('scanignore')
|
||||||
scandelete = getpaths('scandelete')
|
scandelete = getpaths('scandelete')
|
||||||
|
|
||||||
|
try:
|
||||||
ms = magic.open(magic.MIME_TYPE)
|
ms = magic.open(magic.MIME_TYPE)
|
||||||
ms.load()
|
ms.load()
|
||||||
|
except AttributeError:
|
||||||
|
ms = None
|
||||||
|
|
||||||
def toignore(fd):
|
def toignore(fd):
|
||||||
for i in scanignore:
|
for i in scanignore:
|
||||||
|
@ -1187,7 +1190,7 @@ def scan_source(build_dir, root_dir, thisbuild):
|
||||||
if suspect in curfile.lower():
|
if suspect in curfile.lower():
|
||||||
handleproblem('usual supect', fd, fp)
|
handleproblem('usual supect', fd, fp)
|
||||||
|
|
||||||
mime = ms.file(fp)
|
mime = magic.from_file(fp, mime=True) if ms is None else ms.file(fp)
|
||||||
if mime == 'application/x-sharedlib':
|
if mime == 'application/x-sharedlib':
|
||||||
handleproblem('shared library', fd, fp)
|
handleproblem('shared library', fd, fp)
|
||||||
elif mime == 'application/x-archive':
|
elif mime == 'application/x-archive':
|
||||||
|
@ -1204,6 +1207,7 @@ def scan_source(build_dir, root_dir, thisbuild):
|
||||||
if 'DexClassLoader' in line:
|
if 'DexClassLoader' in line:
|
||||||
handleproblem('DexClassLoader', fd, fp)
|
handleproblem('DexClassLoader', fd, fp)
|
||||||
break
|
break
|
||||||
|
if ms is not None:
|
||||||
ms.close()
|
ms.close()
|
||||||
|
|
||||||
# Presence of a jni directory without buildjni=yes might
|
# Presence of a jni directory without buildjni=yes might
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -19,6 +19,7 @@ setup(name='FDroidServer',
|
||||||
'fdroid-icon.png']),
|
'fdroid-icon.png']),
|
||||||
],
|
],
|
||||||
install_requires=[
|
install_requires=[
|
||||||
|
'python-magic',
|
||||||
'PIL',
|
'PIL',
|
||||||
],
|
],
|
||||||
classifiers=[
|
classifiers=[
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue