From a97a98417f4fca0ce7e9c7b32d081691efb6f08d Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Fri, 24 May 2024 15:54:46 +0200 Subject: [PATCH 1/6] Add python 3.12 and set python_requires at least 3.9 --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7ee870b0a32e..fbbe32172f53 100644 --- a/setup.py +++ b/setup.py @@ -34,10 +34,10 @@ def _get_cmdclass(): Programming Language :: Cython Programming Language :: Python Programming Language :: Python :: 3 -Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 +Programming Language :: Python :: 3.12 Programming Language :: Python :: Implementation :: CPython Topic :: Software Development Topic :: Scientific/Engineering @@ -57,6 +57,7 @@ def _get_cmdclass(): classifiers=[_f for _f in CLASSIFIERS.split("\n") if _f], keywords="sycl numpy python3 intel mkl oneapi gpu dpcpp", platforms=["Linux", "Windows"], + python_requires='>=3.9', author="Intel Corporation", url="https://github.com/IntelPython/dpnp", packages=[ From 9422a97800f0286082646bbf189aeaf035d94180 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Fri, 24 May 2024 16:11:38 +0200 Subject: [PATCH 2/6] Add test folder to package data --- setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index fbbe32172f53..bfa3a3dfe85d 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ def _get_cmdclass(): classifiers=[_f for _f in CLASSIFIERS.split("\n") if _f], keywords="sycl numpy python3 intel mkl oneapi gpu dpcpp", platforms=["Linux", "Windows"], - python_requires='>=3.9', + python_requires=">=3.9", author="Intel Corporation", url="https://github.com/IntelPython/dpnp", packages=[ @@ -73,7 +73,9 @@ def _get_cmdclass(): "libdpnp_backend_c.so", "dpnp_backend_c.lib", "dpnp_backend_c.dll", + "tests/*.*", + "tests/third_party/cupy/*.py", ] }, - include_package_data=True, + include_package_data=False, ) From f6a84e47db92bb3f6374948bccdf100bc5cde734 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 27 May 2024 16:04:48 +0200 Subject: [PATCH 3/6] Remove MANIFEST.in --- MANIFEST.in | 2 -- setup.py | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index c4f51f7c8b52..000000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -global-exclude *.cpp -include dpnp/backend/include/*.hpp diff --git a/setup.py b/setup.py index bfa3a3dfe85d..6c78a55e2868 100644 --- a/setup.py +++ b/setup.py @@ -70,11 +70,12 @@ def _get_cmdclass(): ], package_data={ "dpnp": [ + "tests/*.*", + "tests/third_party/cupy/*.py", + "dpnp/backend/include/*.hpp", "libdpnp_backend_c.so", "dpnp_backend_c.lib", "dpnp_backend_c.dll", - "tests/*.*", - "tests/third_party/cupy/*.py", ] }, include_package_data=False, From 3ba2ecf027408c8e4216823c77de0e895f99fa48 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 27 May 2024 16:52:46 +0200 Subject: [PATCH 4/6] Add patched copy --- setup.py | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 6c78a55e2868..56dd2c3e5ccd 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,8 @@ import importlib.machinery as imm import os +import shutil -from skbuild import setup +import skbuild import versioneer @@ -46,7 +47,35 @@ def _get_cmdclass(): Operating System :: Unix """ -setup( +def _patched_copy_file( + src_file, dest_file, hide_listing=True, preserve_mode=True +): + """Copy ``src_file`` to ``dest_file`` ensuring parent directory exists. + + By default, message like `creating directory /path/to/package` and + `copying directory /src/path/to/package -> path/to/package` are displayed + on standard output. Setting ``hide_listing`` to False avoids message from + being displayed. + + NB: Patched here to not follows symbolic links + """ + # Create directory if needed + dest_dir = os.path.dirname(dest_file) + if dest_dir != "" and not os.path.exists(dest_dir): + if not hide_listing: + print("creating directory {}".format(dest_dir)) + skbuild.utils.mkdir_p(dest_dir) + + # Copy file + if not hide_listing: + print("copying {} -> {}".format(src_file, dest_file)) + shutil.copyfile(src_file, dest_file, follow_symlinks=False) + shutil.copymode(src_file, dest_file, follow_symlinks=False) + + +skbuild.setuptools_wrap._copy_file = _patched_copy_file + +skbuild.setup( name="dpnp", version=__version__, cmdclass=_get_cmdclass(), From 77701eeff3dd8ea05c64179c7d72904afe55b984 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 27 May 2024 17:40:45 +0200 Subject: [PATCH 5/6] Corrected a path to tests --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 56dd2c3e5ccd..64da1c04d965 100644 --- a/setup.py +++ b/setup.py @@ -99,8 +99,8 @@ def _patched_copy_file( ], package_data={ "dpnp": [ - "tests/*.*", - "tests/third_party/cupy/*.py", + "../tests/*.*", + "../tests/third_party/cupy/*.py", "dpnp/backend/include/*.hpp", "libdpnp_backend_c.so", "dpnp_backend_c.lib", From 0429f84a2544a8f39418a0ce23fc937754499efd Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Tue, 28 May 2024 15:02:03 +0200 Subject: [PATCH 6/6] Use package_dir --- setup.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 64da1c04d965..bb0f943f1d49 100644 --- a/setup.py +++ b/setup.py @@ -97,14 +97,19 @@ def _patched_copy_file( "dpnp.linalg", "dpnp.random", ], + package_dir={"dpnp": "", + "dpnp.tests": ""}, package_data={ "dpnp": [ - "../tests/*.*", - "../tests/third_party/cupy/*.py", "dpnp/backend/include/*.hpp", "libdpnp_backend_c.so", "dpnp_backend_c.lib", "dpnp_backend_c.dll", + ], + "dpnp.tests": [ + ".*" + "third_party/cupy/*.py", + "third_party/cupy/*/*.py", ] }, include_package_data=False,