Skip to content

Commit 6e20b14

Browse files
authored
Merge pull request #129 from nexB/bump-scancode
Bump scancode-toolkit to 3.1.0
2 parents 89f6d9a + 00ba70c commit 6e20b14

636 files changed

Lines changed: 7104 additions & 5019 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

configure

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,37 @@
11
#!/bin/bash
22
#
3-
# Copyright (c) 2017-2018 nexB Inc. http://www.nexb.com/ - All rights reserved.
3+
# Copyright (c) nexB Inc. http://www.nexb.com/ - All rights reserved.
44
#
5+
6+
set -e
7+
58
################################
69
# change these variables to customize this script locally
710
################################
811
# you can define one or more thirdparty dirs, each prefixed with TPP_DIR
9-
export TPP_DIR_BASE="thirdparty/base"
10-
export TPP_DIR_PROD="thirdparty/prod"
11-
export TPP_DIR_DEV="thirdparty/dev"
12+
export TPP_DIR="thirdparty"
1213

1314
# default configurations for dev
1415
CONF_DEFAULT="etc/conf/dev"
1516
#################################
1617

1718
CFG_CMD_LINE_ARGS="$@"
1819

19-
if [ "$1" == "" ]; then
20+
if [[ "$1" == "" ]]; then
2021
# default for dev conf if not argument is provided
2122
CFG_CMD_LINE_ARGS=$CONF_DEFAULT
2223
fi
2324

24-
python2.7 etc/configure.py $CFG_CMD_LINE_ARGS
25-
if [ -f "bin/activate" ]; then
26-
source bin/activate
25+
CONFIGURE_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
26+
27+
if [[ "$PYTHON_EXE" == "" ]]; then
28+
PYTHON_EXE=python
2729
fi
30+
31+
$PYTHON_EXE "$CONFIGURE_ROOT_DIR/etc/configure.py" $CFG_CMD_LINE_ARGS
32+
33+
if [ -f "$CONFIGURE_ROOT_DIR/bin/activate" ]; then
34+
source "$CONFIGURE_ROOT_DIR/bin/activate"
35+
fi
36+
37+
set +e

configure.bat

Lines changed: 95 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,114 @@
11
@echo OFF
2+
setlocal
3+
@rem Copyright (c) nexB Inc. http://www.nexb.com/ - All rights reserved.
24

3-
@rem Copyright (c) 2015-2018 nexB Inc. http://www.nexb.com/ - All rights reserved.
5+
@rem ################################
6+
@rem # A configuration script for Windows
7+
@rem # The possible options and arguments are:
8+
@rem # --clean : this is exclusive of anything else and cleans the environment
9+
@rem # from built and installed files
10+
@rem # <some conf path> : this must be the last argument and sets the path to a
11+
@rem # configuration directory to use.
12+
@rem # --python < path to python.exe> : this must be the first argument and set
13+
@rem # the path to the Python executable to use. If < path to python.exe> is
14+
@rem # set to "path", then the executable will be the python.exe available
15+
@rem # in the PATH.
16+
@rem ################################
417

518
@rem ################################
6-
@rem # change these variables to customize this script locally
19+
@rem # Defaults. Change these variables to customize this script locally
720
@rem ################################
821
@rem # you can define one or more thirdparty dirs, each prefixed with TPP_DIR
9-
set TPP_DIR_BASE=thirdparty/base
10-
set TPP_DIR_PROD=thirdparty/prod
11-
set TPP_DIR_DEV=thirdparty/dev
22+
set TPP_DIR=thirdparty
1223

24+
@rem # A fallback Python location.
25+
@rem # To use a given interpreter, you should use the --python option with a
26+
@rem # value pointing to your Python executable
27+
set DEFAULT_PYTHON=C:\Python27\python.exe
1328

1429
@rem # default configurations for dev
15-
set CONF_DEFAULT="etc/conf/dev"
30+
set "CONF_DEFAULT=etc/conf/dev"
1631
@rem #################################
1732

18-
set CFG_CMD_LINE_ARGS=
19-
@rem Collect/Slurp all command line arguments in a variable
20-
:collectarg
21-
if ""%1""=="""" (
22-
goto continue
23-
)
24-
call set CFG_CMD_LINE_ARGS=%CFG_CMD_LINE_ARGS% %1
25-
shift
26-
goto collectarg
33+
set CFG_ROOT_DIR=%~dp0
34+
35+
set CONFIGURED_PYTHON=%CFG_ROOT_DIR%Scripts\python.exe
36+
37+
set "CFG_CMD_LINE_ARGS= "
38+
39+
python --version
40+
python -c "import sys;print(sys.executable)"
41+
2742

28-
:continue
43+
@rem parse command line options and arguments
44+
if ""%1""=="""" (
45+
set CFG_CMD_LINE_ARGS=%CONF_DEFAULT%
46+
goto python
47+
)
48+
49+
if ""%1""==""--clean"" (
50+
set CFG_CMD_LINE_ARGS=--clean
51+
goto python
52+
)
2953

30-
@rem default to dev configuration when no args are passed
31-
if "%CFG_CMD_LINE_ARGS%"==" " (
32-
set CFG_CMD_LINE_ARGS="%CONF_DEFAULT%"
33-
goto configure
54+
55+
if ""%1""==""--python"" (
56+
set PROVIDED_PYTHON=%2
57+
if ""%3""=="""" (
58+
set CFG_CMD_LINE_ARGS=%CONF_DEFAULT%
59+
) else (
60+
set CFG_CMD_LINE_ARGS=%3
61+
)
62+
goto python
63+
) else (
64+
set CFG_CMD_LINE_ARGS=%1
65+
goto python
3466
)
3567

36-
if "%CFG_CMD_LINE_ARGS%"==" --init" (
37-
set CFG_CMD_LINE_ARGS="%CONF_INIT%"
38-
goto configure
68+
69+
@rem Pick a Python interpreter
70+
:python
71+
72+
if exist "%CONFIGURED_PYTHON%" (
73+
if not ""%1""==""--clean"" (
74+
@rem we do not want to use the configured Python in clean... it will be deleted
75+
set PYTHON_EXECUTABLE=%CONFIGURED_PYTHON%
76+
goto run
77+
)
3978
)
4079

41-
:configure
42-
call c:\Python27\python.exe etc/configure.py %CFG_CMD_LINE_ARGS%
43-
if exist bin\activate (
44-
bin\activate
80+
if ""%PROVIDED_PYTHON%""==""path"" (
81+
@rem use a bare python available in the PATH
82+
set PYTHON_EXECUTABLE=python
83+
goto run
4584
)
46-
goto EOS
4785

48-
:EOS
86+
if exist "%PROVIDED_PYTHON%" (
87+
set PYTHON_EXECUTABLE=%PROVIDED_PYTHON%
88+
goto run
89+
)
90+
91+
if exist %DEFAULT_PYTHON% (
92+
set PYTHON_EXECUTABLE=%DEFAULT_PYTHON%
93+
goto run
94+
)
95+
96+
if not exist "%PYTHON_EXECUTABLE%" (
97+
echo * Unable to find an installation of Python.
98+
exit /b 1
99+
)
100+
101+
:run
102+
103+
call ""%PYTHON_EXECUTABLE%"" "%CFG_ROOT_DIR%etc\configure.py" %CFG_CMD_LINE_ARGS%
104+
105+
@rem Return a proper return code on failure
106+
if %errorlevel% neq 0 (
107+
exit /b %errorlevel%
108+
)
109+
110+
@rem Activate the virtualenv
111+
endlocal
112+
if exist "%CFG_ROOT_DIR%Scripts\activate" (
113+
"%CFG_ROOT_DIR%Scripts\activate"
114+
)

etc/conf/base.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
1+
from __future__ import absolute_import
12

23
import sys
34

5+
"""
6+
This base config script gets automatically executed for all platforms via
7+
configure.
8+
"""
49

510
"""
611
Check that we run a supported OS and architecture.
712
"""
813

9-
def unsupported():
10-
print('Unsupported OS/platform.')
11-
print('See https://github.com/nexB/deltacode/ for supported OS/platforms.')
12-
print('Enter a ticket https://github.com/nexB/deltacode/issues asking for support of your OS/platform combo.')
14+
15+
def unsupported(platform):
16+
print('Unsupported OS/platform %r.' % platform)
17+
print('See https://github.com/nexB/scancode-toolkit/ for supported OS/platforms.')
18+
print('Enter a ticket https://github.com/nexB/scancode-toolkit/issues asking for support of your OS/platform combo.')
1319
sys.exit(1)
1420

21+
1522
if sys.maxsize > 2 ** 32:
1623
arch = '64'
1724
else:
1825
arch = '32'
1926

2027
sys_platform = str(sys.platform).lower()
21-
if 'linux' in sys_platform:
28+
if sys_platform.startswith('linux'):
2229
os = 'linux'
23-
elif'win32' in sys_platform:
30+
elif 'win32' in sys_platform:
2431
os = 'win'
2532
elif 'darwin' in sys_platform:
2633
os = 'mac'
2734
else:
28-
unsupported()
29-
35+
unsupported(sys_platform)
3036

3137
supported_combos = {
3238
'linux': ['32', '64'],
@@ -36,4 +42,4 @@ def unsupported():
3642

3743
arches = supported_combos[os]
3844
if arch not in arches:
39-
unsupported()
45+
unsupported(os + arch)

etc/conf/dev/base.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

etc/conf/dev/requirements_base.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Testing
2+
aboutcode-toolkit
3+
apipkg
4+
py
5+
pytest
6+
colorama
7+
execnet
8+
pytest-xdist
9+
bumpversion
10+
coverage
11+
pytest-cov
12+
codecov
13+
pytest-rerunfailures
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ setuptools
44
wheel
55
pip
66
wincertstore
7+
six
78

89
# Self
910
-e .

0 commit comments

Comments
 (0)