Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builtins/extractcode_7z_system_provided/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

setup(
name='extractcode_7z_system_provided',
version='16.5.210531',
version='32.0.0',
license='apache-2.0 AND lgpl-2.1 and unrar and brian-gladman-3-clause',
description=desc,
long_description=desc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,41 @@ def get_locations(self):
lib_7z = environ.get('EXTRACTCODE_7Z_PATH')
if not lib_7z:
mainstream_system = platform.system().lower()

if mainstream_system == 'linux':
distribution = platform.linux_distribution()[0].lower()
debian_based_distro = ['ubuntu', 'mint', 'debian']
rpm_based_distro = ['fedora', 'redhat']

if distribution in debian_based_distro:
lib_dir = '/usr/lib/p7zip'

lib_7z = path.join(lib_dir, '7zr')
elif distribution in rpm_based_distro:
lib_dir = '/usr/libexec/p7zip'

lib_7z = path.join(lib_dir, '7za')
else:
raise Exception('Unsupported system: {}'.format(distribution))
elif mainstream_system == 'freebsd':
lib_dir = '/usr/local/libexec/p7zip'
lib_7z = path.join(lib_dir, '7z')
lib_dir = '/usr/local/bin'
lib_7z = path.join(lib_dir, '7z')
elif mainstream_system == 'darwin':
# This assumes that p7zip was installed using Homebrew
lib_dir = '/opt/homebrew/lib/p7zip'
lib_7z = path.join(lib_dir, '7z')
else:
lib_dir = path.dirname(lib_7z)

# Check that path exist
if not path.exists(lib_7z):
raise Exception(
'p7zip not found. Please refer to the scancode-toolkit '
'documentation on how to install p7zip for your system.'
)

locations = {
# extractcode.sevenzip.libdir is not used anymore and deprecated
# but we are keeping it around for now for backward compatibility
'extractcode.sevenzip.libdir': lib_dir,
'extractcode.sevenzip.exe': lib_7z,
}

return locations
2 changes: 1 addition & 1 deletion builtins/extractcode_libarchive_system_provided/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

setup(
name='extractcode_libarchive_system_provided',
version='3.5.1.210531',
version='32.0.0',
license='apache-2.0 AND bsd-simplified',
description=desc,
long_description=desc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,41 @@ def get_locations(self):
if not lib_archive:
system_arch = platform.machine()
mainstream_system = platform.system().lower()

if mainstream_system == 'linux':
distribution = platform.linux_distribution()[0].lower()
debian_based_distro = ['ubuntu', 'mint', 'debian']
rpm_based_distro = ['fedora', 'redhat']

if distribution in debian_based_distro:
lib_dir = '/usr/lib/'+system_arch+'-linux-gnu'

elif distribution in rpm_based_distro:
lib_dir = '/usr/lib64'

else:
raise Exception('Unsupported system: {}'.format(distribution))

lib_archive = path.join(lib_dir, 'libarchive.so.13')
elif mainstream_system == 'freebsd':
if path.isdir('/usr/local/'):
lib_dir = '/usr/local/lib'
else:
lib_dir = '/usr/lib'
lib_archive = path.join(lib_dir, 'libarchive.so')
lib_archive = ''
for lib_dir in ('/usr/local/lib', '/usr/lib'):
possible_lib_archive = path.join(lib_dir, 'libarchive.so')
if path.exists(possible_lib_archive):
lib_archive = possible_lib_archive
break
elif mainstream_system == 'darwin':
# This assumes that libarchive was installed using Homebrew
lib_dir = '/opt/homebrew/opt/libarchive/lib'
lib_archive = path.join(lib_dir, 'libarchive.dylib')
else:
lib_dir = path.dirname(lib_archive)

# Check that path exists
if not path.exists(lib_archive):
raise Exception(
'libarchive not found. Please refer to the scancode-toolkit '
'documentation on how to install libarchive for your system.'
)

locations = {
'extractcode.libarchive.dll': lib_archive,
}
Expand Down
4 changes: 2 additions & 2 deletions builtins/typecode_libmagic_system_provided/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
desc = '''A ScanCode path provider plugin to provide a system package provided libmagic binary and database.'''

setup(
name='typecode_libmagic-system-provided',
version='5.39.210531',
name='typecode_libmagic_system_provided',
version='32.0.0',
license=(
'apache-2.0 AND bsd-simplified-darwin AND (bsd-simplified AND public-domain AND '
'bsd-new AND isc AND (bsd-new OR gpl-1.0-plus) AND bsd-original)'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# Copyright (c) nexB Inc. and others.
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
#
# Redistributions of source code must retain the above copyright notice, this list
# of conditions and the following disclaimer.
#
#
# Redistributions in binary form must reproduce the above copyright notice, this
# list of conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
#
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand All @@ -23,7 +23,6 @@


import platform
from os import environ
from os import path

from plugincode.location_provider import LocationProviderPlugin
Expand All @@ -36,38 +35,54 @@ def get_locations(self):
locations of the libmagic shared library as installed on various Linux
distros or on FreeBSD.
"""

system_arch = platform.machine()
mainstream_system = platform.system().lower()
if mainstream_system == 'linux':
system_arch = platform.machine()
distribution = platform.linux_distribution()[0].lower()
debian_based_distro = ['ubuntu', 'mint', 'debian']
rpm_based_distro = ['fedora', 'redhat']

if distribution in debian_based_distro:
db_dir = '/usr/lib/file'
lib_dir = '/usr/lib/'+system_arch+'-linux-gnu'

elif distribution in rpm_based_distro:
db_dir = '/usr/share/misc'
lib_dir = '/usr/lib64'

else:
raise Exception('Unsupported system: {}'.format(distribution))

dll_loc = path.join(lib_dir, 'libmagic.so')

dll_loc = path.join(lib_dir, 'libmagic.so.1')
elif mainstream_system == 'freebsd':
if path.isdir('/usr/local/'):
lib_dir = '/usr/local'
else:
lib_dir = '/usr'

dll_loc = path.join(lib_dir, 'lib/libmagic.so')
db_dir = path.join(lib_dir,'share/file')
dll_loc = ''
db_dir = ''
for lib_dir in ('/usr/local/', '/usr'):
possible_dll_loc = path.join(lib_dir, 'lib/libmagic.so')
possible_db_loc = path.join(lib_dir, 'share/misc/magic.mgc')
if path.exists(possible_dll_loc) and path.exists(possible_db_loc):
dll_loc = possible_dll_loc
db_dir = path.dirname(possible_db_loc)
break
elif mainstream_system == 'darwin':
# This assumes that libmagic was installed using Homebrew
lib_dir = '/opt/homebrew'
dll_loc = path.join(lib_dir, 'lib/libmagic.dylib')
db_dir = path.join(lib_dir, 'share/misc')

magicdb_loc = path.join(db_dir, 'magic.mgc')

# Check that paths exist
if not path.exists(dll_loc):
raise Exception(
'libmagic not found. Please refer to the scancode-toolkit '
'documentation on how to install libmagic for your operating system.'
)

if not path.exists(magicdb_loc):
raise Exception(
'magic.mgc not found. Please refer to the scancode-toolkit '
'documentation on how to install libmagic for your system.'
)

locations = {
# typecode.libmagic.libdir is not used anymore and deprecated
# but we are keeping it around for now for backward compatibility
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fi


if [[ "$PYTHON_EXE" == "" ]]; then
PYTHON_EXE=python3.6
PYTHON_EXE=python3
fi


Expand Down