diff --git a/.gitattributes b/.gitattributes index 2d555b2092..c446d380f7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,2 @@ -# Set configure.bat's line ending to CRLF. Sometimes batch scripts don't work -# properly on Windows if the line ending is LF and not CRLF -configure.bat eol=crlf +# Ignore all Git auto CR/LF line endings conversions +* binary diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000000..ef3721e8c7 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,15 @@ +graft src + +include *.LICENSE +include NOTICE +include *.ABOUT +include *.toml +include *.yml +include *.rst +include setup.* +include configure* +include requirements* +include .git* + +global-exclude *.py[co] __pycache__ *.*~ + diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000000..65936b2bfd --- /dev/null +++ b/NOTICE @@ -0,0 +1,19 @@ +# +# Copyright (c) nexB Inc. and others. +# SPDX-License-Identifier: Apache-2.0 +# +# Visit https://aboutcode.org and https://github.com/nexB/ for support and download. +# ScanCode is a trademark of nexB Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fad6928d66..9a4c950c40 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,45 +1,64 @@ ################################################################################ -# We use Azure to run the full tests suites on Python 3.6 -# on Windows (32 and 64), macOS and Linux (64 various distro) +# We use Azure to run the full tests suites on multiple Python 3.x +# on multiple Windows, macOS and Linux versions all on 64 bits +# These jobs are using VMs with Azure-provided Python builds ################################################################################ jobs: -################################################################################ -# These jobs are using VMs and Azure-provided Python 3.6 -################################################################################ + - template: etc/ci/azure-linux.yml + parameters: + job_name: ubuntu16_cpython + image_name: ubuntu-16.04 + python_versions: ['3.6', '3.7', '3.8', '3.9'] + test_suites: + all: tmp/bin/pytest -vvs - template: etc/ci/azure-linux.yml parameters: - job_name: ubuntu18_py36 + job_name: ubuntu18_cpython image_name: ubuntu-18.04 - python_versions: ['3.6'] + python_versions: ['3.6', '3.7', '3.8', '3.9'] + test_suites: + all: tmp/bin/pytest -n 2 -vvs + + - template: etc/ci/azure-linux.yml + parameters: + job_name: ubuntu20_cpython + image_name: ubuntu-20.04 + python_versions: ['3.6', '3.7', '3.8', '3.9'] + test_suites: + all: tmp/bin/pytest -n 2 -vvs + + - template: etc/ci/azure-mac.yml + parameters: + job_name: macos1014_cpython + image_name: macos-10.14 + python_versions: ['3.6', '3.7', '3.8', '3.9'] test_suites: all: tmp/bin/pytest -n 2 -vvs - template: etc/ci/azure-mac.yml parameters: - job_name: macos1015_py36 + job_name: macos1015_cpython image_name: macos-10.15 - python_versions: ['3.6'] + python_versions: ['3.6', '3.7', '3.8', '3.9'] test_suites: all: tmp/bin/pytest -n 2 -vvs - template: etc/ci/azure-win.yml parameters: - job_name: win2019_32_py36 - image_name: windows-2019 - python_versions: ['3.6'] - python_architecture: x86 + job_name: win2016_cpython + image_name: vs2017-win2016 + python_versions: ['3.6', '3.7', '3.8', '3.9'] test_suites: - all: tmp\Scripts\pytest -vvs + all: tmp\Scripts\pytest -n 2 -vvs - template: etc/ci/azure-win.yml parameters: - job_name: win2019_64_py36 + job_name: win2019_cpython image_name: windows-2019 - python_versions: ['3.6'] - python_architecture: x64 + python_versions: ['3.6', '3.7', '3.8', '3.9'] test_suites: - all: tmp\Scripts\pytest -vvs + all: tmp\Scripts\pytest -n 2 -vvs diff --git a/configure b/configure index a35c8c9054..8f3a68e3d9 100755 --- a/configure +++ b/configure @@ -1,6 +1,7 @@ #!/usr/bin/env bash # -# Copyright (c) nexB Inc. http://www.nexb.com/ - All rights reserved. +# Copyright (c) nexB Inc. and others. +# SPDX-License-Identifier: Apache-2.0 # set -e diff --git a/configure.bat b/configure.bat index 958f5bf8c3..f03ea07c54 100644 --- a/configure.bat +++ b/configure.bat @@ -1,121 +1,121 @@ -@echo OFF -@setlocal -@rem Copyright (c) nexB Inc. http://www.nexb.com/ - All rights reserved. - -@rem ################################ -@rem # A configuration script for Windows -@rem # -@rem # The options and (optional) arguments are: -@rem # --clean : this is exclusive of anything else and cleans the environment -@rem # from built and installed files -@rem # -@rem # --python < path to python.exe> : this must be the first argument and set -@rem # the path to the Python executable to use. If < path to python.exe> is -@rem # set to "path", then the executable will be the python.exe available -@rem # in the PATH. -@rem ################################ - -@rem Current directory where this .bat files lives -set CFG_ROOT_DIR=%~dp0 -@rem path where a configured Python should live in the current virtualenv if installed -set CONFIGURED_PYTHON=%CFG_ROOT_DIR%tmp\Scripts\python.exe -set PYTHON_EXECUTABLE= - - -@rem parse command line options and arguments -:collectopts -if "%1" EQU "--help" (goto cli_help) -if "%1" EQU "--clean" (call rmdir /s /q "%CFG_ROOT_DIR%tmp") && call exit /b -if "%1" EQU "--python" (set PROVIDED_PYTHON=%~2) && shift && shift && goto collectopts - -@rem If we have a pre-configured Python in our virtualenv, reuse this as-is and run -if exist ""%CONFIGURED_PYTHON%"" ( - set PYTHON_EXECUTABLE=%CONFIGURED_PYTHON% - goto run -) - -@rem If we have a command arg for Python use this as-is -if ""%PROVIDED_PYTHON%""==""path"" ( - @rem use a bare python available in the PATH - set PYTHON_EXECUTABLE=python - goto run -) -if exist ""%PROVIDED_PYTHON%"" ( - set PYTHON_EXECUTABLE=%PROVIDED_PYTHON% - goto run -) - - -@rem otherwise we search for a suitable Python interpreter -:find_python -@rem First check the existence of the "py" launcher (available in Python 3) -@rem if we have it, check if we have a py -3 installed with the good version or a py 2.7 -@rem if not, check if we have an old py 2.7 -@rem exist if all fails - -where py >nul 2>nul -if %ERRORLEVEL% == 0 ( - @rem we have a py launcher, check for the availability of our required Python 3 version - py -3.6 --version >nul 2>nul - if %ERRORLEVEL% == 0 ( - set PYTHON_EXECUTABLE=py -3.6 - ) else ( - @rem we have no required python 3, let's try python 2: - py -2 --version >nul 2>nul - if %ERRORLEVEL% == 0 ( - set PYTHON_EXECUTABLE=py -2 - ) else ( - @rem we have py and no python 3 and 2, exit - echo * Unable to find an installation of Python. - exit /b 1 - ) - ) -) else ( - @rem we have no py launcher, check for a default Python 2 installation - if not exist ""%DEFAULT_PYTHON2%"" ( - echo * Unable to find an installation of Python. - exit /b 1 - ) else ( - set PYTHON_EXECUTABLE=%DEFAULT_PYTHON2% - ) -) - - -:run -@rem without this things may not always work on Windows 10, but this makes things slower -set PYTHONDONTWRITEBYTECODE=1 - -call mkdir "%CFG_ROOT_DIR%tmp" -call curl -o "%CFG_ROOT_DIR%tmp\virtualenv.pyz" https://bootstrap.pypa.io/virtualenv.pyz -call %PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%tmp\virtualenv.pyz" "%CFG_ROOT_DIR%tmp" -call "%CFG_ROOT_DIR%tmp\Scripts\activate" -call "%CFG_ROOT_DIR%tmp\Scripts\pip" install --upgrade pip virtualenv setuptools wheel -call "%CFG_ROOT_DIR%tmp\Scripts\pip" install -e .[testing] - -@rem Return a proper return code on failure -if %ERRORLEVEL% neq 0 ( - exit /b %ERRORLEVEL% -) -endlocal -goto activate - - -:cli_help -echo A configuration script for Windows -echo usage: configure [options] [path/to/config/directory] -echo. -echo The options and arguments are: -echo --clean : this is exclusive of anything else and cleans the environment -echo from built and installed files -echo. -echo --python path/to/python.exe : this is set to the path of an alternative -echo Python executable to use. If path/to/python.exe is set to "path", -echo then the executable will be the python.exe available in the PATH. -echo. - - -:activate -@rem Activate the virtualenv -if exist "%CFG_ROOT_DIR%tmp\Scripts\activate" ( - "%CFG_ROOT_DIR%tmp\Scripts\activate" -) +@echo OFF +@setlocal +@rem Copyright (c) nexB Inc. http://www.nexb.com/ - All rights reserved. + +@rem ################################ +@rem # A configuration script for Windows +@rem # +@rem # The options and (optional) arguments are: +@rem # --clean : this is exclusive of anything else and cleans the environment +@rem # from built and installed files +@rem # +@rem # --python < path to python.exe> : this must be the first argument and set +@rem # the path to the Python executable to use. If < path to python.exe> is +@rem # set to "path", then the executable will be the python.exe available +@rem # in the PATH. +@rem ################################ + +@rem Current directory where this .bat files lives +set CFG_ROOT_DIR=%~dp0 +@rem path where a configured Python should live in the current virtualenv if installed +set CONFIGURED_PYTHON=%CFG_ROOT_DIR%tmp\Scripts\python.exe +set PYTHON_EXECUTABLE= + + +@rem parse command line options and arguments +:collectopts +if "%1" EQU "--help" (goto cli_help) +if "%1" EQU "--clean" (call rmdir /s /q "%CFG_ROOT_DIR%tmp") && call exit /b +if "%1" EQU "--python" (set PROVIDED_PYTHON=%~2) && shift && shift && goto collectopts + +@rem If we have a pre-configured Python in our virtualenv, reuse this as-is and run +if exist ""%CONFIGURED_PYTHON%"" ( + set PYTHON_EXECUTABLE=%CONFIGURED_PYTHON% + goto run +) + +@rem If we have a command arg for Python use this as-is +if ""%PROVIDED_PYTHON%""==""path"" ( + @rem use a bare python available in the PATH + set PYTHON_EXECUTABLE=python + goto run +) +if exist ""%PROVIDED_PYTHON%"" ( + set PYTHON_EXECUTABLE=%PROVIDED_PYTHON% + goto run +) + + +@rem otherwise we search for a suitable Python interpreter +:find_python +@rem First check the existence of the "py" launcher (available in Python 3) +@rem if we have it, check if we have a py -3 installed with the good version or a py 2.7 +@rem if not, check if we have an old py 2.7 +@rem exist if all fails + +where py >nul 2>nul +if %ERRORLEVEL% == 0 ( + @rem we have a py launcher, check for the availability of our required Python 3 version + py -3.6 --version >nul 2>nul + if %ERRORLEVEL% == 0 ( + set PYTHON_EXECUTABLE=py -3.6 + ) else ( + @rem we have no required python 3, let's try python 2: + py -2 --version >nul 2>nul + if %ERRORLEVEL% == 0 ( + set PYTHON_EXECUTABLE=py -2 + ) else ( + @rem we have py and no python 3 and 2, exit + echo * Unable to find an installation of Python. + exit /b 1 + ) + ) +) else ( + @rem we have no py launcher, check for a default Python 2 installation + if not exist ""%DEFAULT_PYTHON2%"" ( + echo * Unable to find an installation of Python. + exit /b 1 + ) else ( + set PYTHON_EXECUTABLE=%DEFAULT_PYTHON2% + ) +) + + +:run +@rem without this things may not always work on Windows 10, but this makes things slower +set PYTHONDONTWRITEBYTECODE=1 + +call mkdir "%CFG_ROOT_DIR%tmp" +call curl -o "%CFG_ROOT_DIR%tmp\virtualenv.pyz" https://bootstrap.pypa.io/virtualenv.pyz +call %PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%tmp\virtualenv.pyz" "%CFG_ROOT_DIR%tmp" +call "%CFG_ROOT_DIR%tmp\Scripts\activate" +call "%CFG_ROOT_DIR%tmp\Scripts\pip" install --upgrade pip virtualenv setuptools wheel +call "%CFG_ROOT_DIR%tmp\Scripts\pip" install -e .[testing] + +@rem Return a proper return code on failure +if %ERRORLEVEL% neq 0 ( + exit /b %ERRORLEVEL% +) +endlocal +goto activate + + +:cli_help +echo A configuration script for Windows +echo usage: configure [options] [path/to/config/directory] +echo. +echo The options and arguments are: +echo --clean : this is exclusive of anything else and cleans the environment +echo from built and installed files +echo. +echo --python path/to/python.exe : this is set to the path of an alternative +echo Python executable to use. If path/to/python.exe is set to "path", +echo then the executable will be the python.exe available in the PATH. +echo. + + +:activate +@rem Activate the virtualenv +if exist "%CFG_ROOT_DIR%tmp\Scripts\activate" ( + "%CFG_ROOT_DIR%tmp\Scripts\activate" +) diff --git a/pyproject.toml b/pyproject.toml index e75f1ceca5..55fb92c352 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,11 +36,11 @@ norecursedirs = [ python_files = "*.py" -python_classes="Test" -python_functions="test" +python_classes = "Test" +python_functions = "test" addopts = [ "-rfExXw", "--strict", "--doctest-modules" -] \ No newline at end of file +] diff --git a/setup.cfg b/setup.cfg index e4274bb03f..f7910848b3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,11 +1,15 @@ -[wheel] -universal=1 - [metadata] -license_file = apache-2.0.LICENSE +license_files = + apache-2.0.LICENSE + NOTICE + AUTHORS.rst + CHANGELOG.rst name = skeleton author = nexB. Inc. and others author_email = info@aboutcode.org +license = Apache-2.0 + +# description must be on ONE line https://github.com/pypa/setuptools/issues/1390 description = skeleton long_description = file:README.rst url = https://github.com/nexB/skeleton @@ -17,6 +21,7 @@ classifiers = Topic :: Software Development Topic :: Utilities keywords = + utilities [options] package_dir= diff --git a/setup.py b/setup.py index 45f160da69..bac24a43d9 100644 --- a/setup.py +++ b/setup.py @@ -3,4 +3,4 @@ import setuptools if __name__ == "__main__": - setuptools.setup() \ No newline at end of file + setuptools.setup() diff --git a/src/README.rst b/src/README.rst index efb1a14a15..ec651fcfd3 100644 --- a/src/README.rst +++ b/src/README.rst @@ -1,5 +1,2 @@ -Package Module --------------- - -Put your python modules in this directory. +Put your Python source code (and installable data) in this directory. diff --git a/tests/README.rst b/tests/README.rst new file mode 100644 index 0000000000..d94783e6fb --- /dev/null +++ b/tests/README.rst @@ -0,0 +1,2 @@ +Put your Python test modules in this directory. +