Add a new audit to find missing package.py files (#45868)

* Add a new audit to find missing package.py files

* Remove directory without package.py
This commit is contained in:
Massimiliano Culpo 2024-08-22 23:22:54 +02:00 committed by GitHub
parent d5eefcba87
commit ead25b1e9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 49 deletions

View File

@ -42,6 +42,7 @@ def _search_duplicate_compilers(error_cls):
import inspect
import io
import itertools
import os
import pathlib
import pickle
import re
@ -210,6 +211,11 @@ def _search_duplicate_compilers(error_cls):
group="configs", tag="CFG-PACKAGES", description="Sanity checks on packages.yaml", kwargs=()
)
#: Sanity checks on packages.yaml
config_repos = AuditClass(
group="configs", tag="CFG-REPOS", description="Sanity checks on repositories", kwargs=()
)
@config_packages
def _search_duplicate_specs_in_externals(error_cls):
@ -367,6 +373,27 @@ def _ensure_all_virtual_packages_have_default_providers(error_cls):
]
@config_repos
def _ensure_no_folders_without_package_py(error_cls):
"""Check that we don't leave any folder without a package.py in repos"""
errors = []
for repository in spack.repo.PATH.repos:
missing = []
for entry in os.scandir(repository.packages_path):
if not entry.is_dir():
continue
package_py = pathlib.Path(entry.path) / spack.repo.package_file_name
if not package_py.exists():
missing.append(entry.path)
if missing:
summary = (
f"The '{repository.namespace}' repository misses a package.py file"
f" in the following folders"
)
errors.append(error_cls(summary=summary, details=[f"{x}" for x in missing]))
return errors
def _make_config_error(config_data, summary, error_cls):
s = io.StringIO()
s.write("Occurring in the following file:\n")
@ -527,7 +554,7 @@ def _ensure_all_package_names_are_lowercase(pkgs, error_cls):
badname_regex, errors = re.compile(r"[_A-Z]"), []
for pkg_name in pkgs:
if badname_regex.search(pkg_name):
error_msg = "Package name '{}' is either lowercase or conatine '_'".format(pkg_name)
error_msg = f"Package name '{pkg_name}' should be lowercase and must not contain '_'"
errors.append(error_cls(error_msg, []))
return errors

View File

@ -1,48 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e98d74d..de8740e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,7 +55,7 @@ macro(add_library NAME)
endif()
endmacro()
find_package(hip)
-
+set( Tensile_TEST_LOCAL_PATH "" CACHE PATH "Use local Tensile directory instead of fetching a GitHub branch" )
if(CMAKE_CXX_COMPILER MATCHES ".*/hcc$")
set(TENSILE_USE_LLVM ON CACHE BOOL "Use LLVM for parsing config files.")
set(TENSILE_USE_MSGPACK OFF CACHE BOOL "Use msgpack for parsing config files.")
@@ -79,11 +79,30 @@ endif()
# set(MIOPEN_TENSILE_SRC dev)
# endif()
# Use the virtual-env setup and download package from specified repo:
-virtualenv_install(wheel)
-virtualenv_install("git+https://github.com/ROCmSoftwarePlatform/Tensile.git@${MIOPEN_TENSILE_TAG}")
-list(APPEND CMAKE_PREFIX_PATH ${VIRTUALENV_HOME_DIR})
-find_package(Tensile REQUIRED COMPONENTS HIP)
+option(BUILD_USING_LOCAL_TENSILE "Build as a shared library" ON )
+
+if (WIN32)
+ set( Tensile_ROOT "${CMAKE_BINARY_DIR}/virtualenv/Lib/site-packages/Tensile" )
+endif()
+
+include(virtualenv)
+if (BUILD_USING_LOCAL_TENSILE)
+ virtualenv_install(${Tensile_TEST_LOCAL_PATH})
+ message (STATUS "using local Tensile from ${Tensile_TEST_LOCAL_PATH}, copied to ${Tensile_ROOT}")
+else()
+ # Use the virtual-env setup and download package from specified repot:
+ set( tensile_fork "ROCmSoftwarePlatform" CACHE STRING "Tensile fork to use" )
+ virtualenv_install("git+https://github.com/${tensile_fork}/Tensile.git@${MIOPEN_TENSILE_TAG}")
+ message (STATUS "using GIT Tensile fork=${tensile_fork} from branch=${MIOPEN_TENSILE_TAG}")
+endif()
+message(STATUS "Adding ${VIRTUALENV_HOME_DIR} to CMAKE_PREFIX_PATH")
+list(APPEND CMAKE_PREFIX_PATH ${VIRTUALENV_HOME_DIR})
+if (TENSILE_VERSION)
+ find_package(Tensile ${TENSILE_VERSION} EXACT REQUIRED HIP LLVM PATHS "${INSTALLED_TENSILE_PATH}")
+else()
+ find_package(Tensile 4.28.0 EXACT REQUIRED HIP LLVM PATHS "${INSTALLED_TENSILE_PATH}")
+endif()
set_target_properties( TensileHost PROPERTIES POSITION_INDEPENDENT_CODE ON )