Skip to content

Commit

Permalink
BLD: Check for submodules before build (#23372)
Browse files Browse the repository at this point in the history
- DOC: update git clone command in doc to initialize submodules
- BLD: Check for submodules before building
- CI: update meson.build check and Cirrus for new git submodule

[skip ci]

Co-authored-by: Ralf Gommers <ralf.gommers@gmail.com>
  • Loading branch information
r-devulap and rgommers committed Mar 12, 2023
1 parent 89d6441 commit 6e34d87
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions doc/source/dev/index.rst
Expand Up @@ -45,7 +45,7 @@ Here's the short summary, complete TOC links are below:

* Clone the project to your local computer::

git clone https://github.com/your-username/numpy.git
git clone --recurse-submodules https://github.com/your-username/numpy.git

* Change the directory::

Expand Down Expand Up @@ -180,7 +180,7 @@ Guidelines
get no response to your pull request within a week.

.. _stylistic-guidelines:

Stylistic Guidelines
--------------------

Expand Down
3 changes: 3 additions & 0 deletions numpy/core/meson.build
Expand Up @@ -83,6 +83,9 @@ if use_svml
error('Missing the `SVML` git submodule! Run `git submodule update --init` to fix this.')
endif
endif
if not fs.exists('src/npysort/x86-simd-sort/README.md')
error('Missing the `x86-simd-sort` git submodule! Run `git submodule update --init` to fix this.')
endif

# Check sizes of types. Note, some of these landed in config.h before, but were
# unused. So clean that up and only define the NPY_SIZEOF flavors rather than
Expand Down
16 changes: 10 additions & 6 deletions numpy/core/setup.py
Expand Up @@ -79,11 +79,13 @@ def can_link_svml():
and "linux" in platform
and sys.maxsize > 2**31)

def check_svml_submodule(svmlpath):
if not os.path.exists(svmlpath + "/README.md"):
raise RuntimeError("Missing `SVML` submodule! Run `git submodule "
"update --init` to fix this.")
return True
def check_git_submodules():
out = os.popen("git submodule status")
modules = out.readlines()
for submodule in modules:
if (submodule.strip()[0] == "-"):
raise RuntimeError("git submodules are not initialized."
"Please run `git submodule update --init` to fix this.")

def pythonlib_dir():
"""return path where libpython* is."""
Expand Down Expand Up @@ -414,6 +416,8 @@ def configuration(parent_package='',top_path=None):
# actual C API VERSION. Will raise a MismatchCAPIError if so.
check_api_version(C_API_VERSION, codegen_dir)

check_git_submodules()

generate_umath_py = join(codegen_dir, 'generate_umath.py')
n = dot_join(config.name, 'generate_umath')
generate_umath = exec_mod_from_location('_'.join(n.split('.')),
Expand Down Expand Up @@ -1036,7 +1040,7 @@ def generate_umath_doc_header(ext, build_dir):
# after all maintainable code.
svml_filter = (
)
if can_link_svml() and check_svml_submodule(svml_path):
if can_link_svml():
svml_objs = glob.glob(svml_path + '/**/*.s', recursive=True)
svml_objs = [o for o in svml_objs if not o.endswith(svml_filter)]

Expand Down
4 changes: 3 additions & 1 deletion tools/ci/cirrus_general.yml
Expand Up @@ -6,7 +6,6 @@ build_and_store_wheels: &BUILD_AND_STORE_WHEELS
wheels_artifacts:
path: "wheelhouse/*"


######################################################################
# Build linux_aarch64 natively
######################################################################
Expand All @@ -24,11 +23,14 @@ linux_aarch64_task:
# single task takes longer than 60 mins (the default time limit for a
# cirrus-ci task).
- env:
CIRRUS_CLONE_SUBMODULES: true
CIBW_BUILD: cp39-*
EXPECT_CPU_FEATURES: NEON NEON_FP16 NEON_VFPV4 ASIMD ASIMDHP ASIMDDP ASIMDFHM
- env:
CIRRUS_CLONE_SUBMODULES: true
CIBW_BUILD: cp310-*
- env:
CIRRUS_CLONE_SUBMODULES: true
CIBW_BUILD: cp311-*

build_script: |
Expand Down

0 comments on commit 6e34d87

Please sign in to comment.