diff --git a/bin/install_libs.py b/bin/install_libs.py new file mode 100644 index 0000000..32532aa --- /dev/null +++ b/bin/install_libs.py @@ -0,0 +1,60 @@ +# nxpy ------------------------------------------------------------------------ + +# Copyright Nicola Musatti 2024 +# Use, modification, and distribution are subject to the Boost Software +# License, Version 1.0. (See accompanying file LICENSE.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# See https://github.com/nmusatti/nxpy. --------------------------------------- + +r""" +Use pip to install all libraries. + +""" +import os +import subprocess +import sys + +from six import iteritems + +SOURCES = { + 'nxpy_abstract' : 'libs/abstract', + 'nxpy_backup_file' : 'libs/backup_file', + 'nxpy_command' : 'libs/command', + 'nxpy_core' : 'libs/core', + 'nxpy_file' : 'libs/file', + 'nxpy_file_object' : 'libs/file_object', + 'nxpy_maven' : 'libs/maven', + 'nxpy_memo' : 'libs/memo', + 'nxpy_nonblocking_subprocess' : 'libs/nonblocking_subprocess', + 'nxpy_past' : 'libs/past', + 'nxpy_path' : 'libs/path', + 'nxpy_ply' : 'libs/ply', + 'nxpy_sequence' : 'libs/sequence', + 'nxpy_sort' : 'libs/sort', + 'nxpy_svn' : 'libs/svn', + 'nxpy_temp_file' : 'libs/temp_file', + 'nxpy_test' : 'libs/test', + 'nxpy_xml' : 'libs/xml', +} + +def install_libs(sources, develop=False): + print("installing all libs in {} mode".format( + "development" if develop else "normal")) + wd = os.getcwd() + for k, v in iteritems(sources): + try: + os.chdir(os.path.join(wd, v)) + if develop: + subprocess.call([sys.executable, '-m', 'pip', 'install', '-e', '.']) + else: + subprocess.call([sys.executable, '-m', 'pip', 'install', '.']) + except Exception as e: + print("Oops, something went wrong installing", k) + print(e) + finally: + os.chdir(wd) + +if __name__ == '__main__': + develop = len(sys.argv) == 2 and sys.argv[1] in ( "-d", "--develop") + install_libs(SOURCES, develop) diff --git a/libs/abstract/pyproject.toml b/libs/abstract/pyproject.toml index 9e84b92..3e3658b 100644 --- a/libs/abstract/pyproject.toml +++ b/libs/abstract/pyproject.toml @@ -1,3 +1,12 @@ +# nxpy_abstract --------------------------------------------------------------- + +# Copyright Nicola Musatti 2024 +# Use, modification, and distribution are subject to the Boost Software +# License, Version 1.0. (See accompanying file LICENSE.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# See https://github.com/nmusatti/nxpy/tree/master/libs/abstract. ------------- + [build-system] #requires = ["hatchling"] #build-backend = "hatchling.build" @@ -9,7 +18,7 @@ name = "nxpy-abstract" dynamic = ["version"] description = "Abstract class helpers" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/backup_file/pyproject.toml b/libs/backup_file/pyproject.toml index f884fc3..f397d71 100644 --- a/libs/backup_file/pyproject.toml +++ b/libs/backup_file/pyproject.toml @@ -1,13 +1,24 @@ +# nxpy_backup_file ------------------------------------------------------------ + +# Copyright Nicola Musatti 2024 +# Use, modification, and distribution are subject to the Boost Software +# License, Version 1.0. (See accompanying file LICENSE.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# See https://github.com/nmusatti/nxpy/tree/master/libs/backup_file. ---------- + [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-backup-file" dynamic = ["version"] description = "A file-like object that keeps a copy of the file being edited" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/command/pyproject.toml b/libs/command/pyproject.toml index 6a95eb1..6b4b26b 100644 --- a/libs/command/pyproject.toml +++ b/libs/command/pyproject.toml @@ -1,13 +1,24 @@ +# nxpy_command ---------------------------------------------------------------- + +# Copyright Nicola Musatti 2024 +# Use, modification, and distribution are subject to the Boost Software +# License, Version 1.0. (See accompanying file LICENSE.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# See https://github.com/nmusatti/nxpy/tree/master/libs/command. -------------- + [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-command" dynamic = ["version"] description = "Wrap programs to call them as Python methods" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/core/pyproject.toml b/libs/core/pyproject.toml index 8a99382..f57da35 100644 --- a/libs/core/pyproject.toml +++ b/libs/core/pyproject.toml @@ -1,13 +1,24 @@ +# nxpy_core ------------------------------------------------------------------- + +# Copyright Nicola Musatti 2024 +# Use, modification, and distribution are subject to the Boost Software +# License, Version 1.0. (See accompanying file LICENSE.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# See https://github.com/nmusatti/nxpy/tree/master/libs/core. ----------------- + [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-core" dynamic = ["version"] description = "Infrastructure common to the Nxpy libraries" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/file/pyproject.toml b/libs/file/pyproject.toml index 1e83193..efa007c 100644 --- a/libs/file/pyproject.toml +++ b/libs/file/pyproject.toml @@ -1,13 +1,24 @@ +# nxpy_file ------------------------------------------------------------------- + +# Copyright Nicola Musatti 2024 +# Use, modification, and distribution are subject to the Boost Software +# License, Version 1.0. (See accompanying file LICENSE.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# See https://github.com/nmusatti/nxpy/tree/master/libs/file. ----------------- + [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-file" dynamic = ["version"] description = "File manipulation utilities" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/file_object/pyproject.toml b/libs/file_object/pyproject.toml index 708e5bf..dd5ebc0 100644 --- a/libs/file_object/pyproject.toml +++ b/libs/file_object/pyproject.toml @@ -1,13 +1,24 @@ +# nxpy_file_object ------------------------------------------------------------ + +# Copyright Nicola Musatti 2024 +# Use, modification, and distribution are subject to the Boost Software +# License, Version 1.0. (See accompanying file LICENSE.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# See https://github.com/nmusatti/nxpy/tree/master/libs/file_object. ---------- + [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-file-object" dynamic = ["version"] description = "Helper classes to implement file-like objects" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/maven/pyproject.toml b/libs/maven/pyproject.toml index 4b3119b..36aa202 100644 --- a/libs/maven/pyproject.toml +++ b/libs/maven/pyproject.toml @@ -1,13 +1,24 @@ +# nxpy_maven ------------------------------------------------------------------ + +# Copyright Nicola Musatti 2024 +# Use, modification, and distribution are subject to the Boost Software +# License, Version 1.0. (See accompanying file LICENSE.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# See https://github.com/nmusatti/nxpy/tree/master/libs/maven. ---------------- + [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-maven" dynamic = ["version"] description = "Utilities for the Maven build tool" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/memo/pyproject.toml b/libs/memo/pyproject.toml index 6ae718d..c42fcb5 100644 --- a/libs/memo/pyproject.toml +++ b/libs/memo/pyproject.toml @@ -1,13 +1,24 @@ +# nxpy_memo ------------------------------------------------------------------- + +# Copyright Nicola Musatti 2024 +# Use, modification, and distribution are subject to the Boost Software +# License, Version 1.0. (See accompanying file LICENSE.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# See https://github.com/nmusatti/nxpy/tree/master/libs/memo. ----------------- + [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-memo" dynamic = ["version"] description = "Base class to implement self-memoizing types" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/nonblocking_subprocess/pyproject.toml b/libs/nonblocking_subprocess/pyproject.toml index b20bfb1..c55a51c 100644 --- a/libs/nonblocking_subprocess/pyproject.toml +++ b/libs/nonblocking_subprocess/pyproject.toml @@ -1,13 +1,24 @@ +# nxpy_nonblocking_subprocess ------------------------------------------------- + +# Copyright Nicola Musatti 2024 +# Use, modification, and distribution are subject to the Boost Software +# License, Version 1.0. (See accompanying file LICENSE.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# See https://github.com/nmusatti/nxpy/tree/master/libs/nonblocking_subprocess. + [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-nonblocking-subprocess" dynamic = ["version"] description = "subprocess.Popen subclass using non-blocking I/O" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/past/pyproject.toml b/libs/past/pyproject.toml index 61f4230..b07f12d 100644 --- a/libs/past/pyproject.toml +++ b/libs/past/pyproject.toml @@ -1,13 +1,15 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-past" dynamic = ["version"] description = "Python version based conditionals" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/path/pyproject.toml b/libs/path/pyproject.toml index 6de9ce2..0d148a6 100644 --- a/libs/path/pyproject.toml +++ b/libs/path/pyproject.toml @@ -1,13 +1,15 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-path" dynamic = ["version"] description = "Wrap programs to call them as Python methods" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/ply/pyproject.toml b/libs/ply/pyproject.toml index 7be5668..5765c89 100644 --- a/libs/ply/pyproject.toml +++ b/libs/ply/pyproject.toml @@ -1,13 +1,15 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-ply" dynamic = ["version"] description = "Utilities for the PLY parser generator" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/sequence/pyproject.toml b/libs/sequence/pyproject.toml index 01fa0b7..ef37746 100644 --- a/libs/sequence/pyproject.toml +++ b/libs/sequence/pyproject.toml @@ -1,13 +1,15 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-sequence" dynamic = ["version"] description = "Sequence related tools" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/sort/pyproject.toml b/libs/sort/pyproject.toml index a9a3d8c..dfbea63 100644 --- a/libs/sort/pyproject.toml +++ b/libs/sort/pyproject.toml @@ -1,13 +1,15 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-sort" dynamic = ["version"] description = "Sorting utilities" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/svn/pyproject.toml b/libs/svn/pyproject.toml index 71c227b..550d0ea 100644 --- a/libs/svn/pyproject.toml +++ b/libs/svn/pyproject.toml @@ -1,13 +1,15 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-svn" dynamic = ["version"] description = "Python wrapper for Subversion" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/temp_file/pyproject.toml b/libs/temp_file/pyproject.toml index 4addb74..4c694cf 100644 --- a/libs/temp_file/pyproject.toml +++ b/libs/temp_file/pyproject.toml @@ -1,13 +1,15 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-temp-file" dynamic = ["version"] description = "Temporary file and directory handling" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/test/pyproject.toml b/libs/test/pyproject.toml index c98177d..ce51a9e 100644 --- a/libs/test/pyproject.toml +++ b/libs/test/pyproject.toml @@ -1,13 +1,15 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-test" dynamic = ["version"] description = "Test related utilities for the Nxpy libraries" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/libs/xml/pyproject.toml b/libs/xml/pyproject.toml index 8ba9470..47e73da 100644 --- a/libs/xml/pyproject.toml +++ b/libs/xml/pyproject.toml @@ -1,13 +1,15 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = ["setuptools"] +build-backend = "setuptools.build_meta" [project] name = "nxpy-xml" dynamic = ["version"] description = "Utilities for the Lxml library" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/pyproject.toml b/pyproject.toml index beda8a3..8259f0d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,18 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +#requires = ["hatchling"] +#build-backend = "hatchling.build" +requires = [ + "setuptools", + "six" +] +build-backend = "setuptools.build_meta" [project] name = "Nxpy" dynamic = ["version"] description = "Nick's Python Toolbox" readme = "README.rst" -license = "Boost Software License 1.0 (BSL-1.0)" +license.file = "LICENSE.txt" authors = [ { name = "Nicola Musatti", email = "nicola.musatti@gmail.com" }, ] diff --git a/test/bin/setup_test_env.py b/test/bin/setup_test_env.py index 1108c0e..0ae9aa0 100644 --- a/test/bin/setup_test_env.py +++ b/test/bin/setup_test_env.py @@ -43,6 +43,8 @@ def main(msgs=False): except KeyError: env_dir = "" base_dest_dir = "" + if len(sys.argv) == 2: + env_dir = sys.argv[1] if msgs: base_dest_dir = input("Test data directory [" + env_dir + "]: ") six.print_("Directory:", base_dest_dir) diff --git a/tox.ini b/tox.ini index 1f2bb33..3c09490 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 4.0 -envlist = py{27,37,38,39,310,311}-{mylinux,mymacos,mywindows} +envlist = py{27,38,39,310,311,312}-{mylinux,mymacos,mywindows} [testenv] platform = @@ -8,17 +8,18 @@ platform = mymacos: darwin mywindows: win32 -setenv = - mylinux,mymacos: NXPY_TEST_DIR = {toxinidir}/tmp/nxpy - mywindows: NXPY_TEST_DIR = {toxinidir}\tmp\nxpy +set_env = + mylinux, mymacos: NXPY_TEST_DIR={toxinidir}/tmp/nxpy + mywindows: NXPY_TEST_DIR={toxinidir}\tmp\nxpy -passenv = +pass_env = JAVA_HOME - mywindows: USERNAME M2_HOME + mywindows: USERNAME allowlist_externals = mkdir + mvn deps = pytest @@ -26,8 +27,9 @@ deps = six commands = - pip install -e . - mylinux,mymacos: -mkdir -p {toxinidir}/tmp/nxpy - mywindows: -mkdir {toxinidir}\tmp\nxpy - python test/bin/setup_test_env.py - python -m pytest --color=yes libs -s + python bin/install_libs.py -d + mylinux, mymacos: -mkdir -p {toxinidir}/tmp/nxpy + mywindows: -mkdir -p {toxinidir}\tmp\nxpy + mylinux, mymacos: python test/bin/setup_test_env.py + mywindows: python test/bin/setup_test_env.py + python -m pytest --color=yes libs -s