Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating a few headers that have been renamed in raft #2090

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 79 additions & 29 deletions ci/checks/copyright.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2021, NVIDIA CORPORATION.
# Copyright (c) 2020-2022, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,17 @@
import argparse
import io
import os
import git_helpers
import sys

SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.expanduser(__file__)))

# Add the scripts dir for gitutils
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR,
"../../cpp/scripts")))

# Now import gitutils. Ignore flake8 error here since there is no other way to
# set up imports
import gitutils # noqa: E402

FilesToCheck = [
re.compile(r"[.](cmake|cpp|cu|cuh|h|hpp|sh|pxd|py|pyx)$"),
Expand All @@ -28,22 +38,25 @@
re.compile(r"[.]flake8[.]cython$"),
re.compile(r"meta[.]yaml$")
]
ExemptFiles = []

# this will break starting at year 10000, which is probably OK :)
CheckSimple = re.compile(r"Copyright \(c\) (\d{4}), NVIDIA CORPORATION")
CheckSimple = re.compile(
r"Copyright *(?:\(c\))? *(\d{4}),? *NVIDIA C(?:ORPORATION|orporation)")
CheckDouble = re.compile(
r"Copyright \(c\) (\d{4})-(\d{4}), NVIDIA CORPORATION")
r"Copyright *(?:\(c\))? *(\d{4})-(\d{4}),? *NVIDIA C(?:ORPORATION|orporation)" # noqa: E501
)


def checkThisFile(f):
# This check covers things like symlinks which point to files that DNE
if not(os.path.exists(f)):
if not (os.path.exists(f)):
return False
if git_helpers and git_helpers.isFileEmpty(f):
return False
# Special case for versioneer.py - it uses a separate copyright.
if os.path.basename(f) == "versioneer.py":
if gitutils and gitutils.isFileEmpty(f):
return False
for exempt in ExemptFiles:
if exempt.search(f):
return False
for checker in FilesToCheck:
if checker.search(f):
return True
Expand Down Expand Up @@ -87,12 +100,22 @@ def checkCopyright(f, update_current_year):
continue
crFound = True
if start > end:
e = [f, lineNum, "First year after second year in the copyright "
"header (manual fix required)", None]
e = [
f,
lineNum,
"First year after second year in the copyright "
"header (manual fix required)",
None
]
errs.append(e)
if thisYear < start or thisYear > end:
e = [f, lineNum, "Current year not included in the "
"copyright header", None]
e = [
f,
lineNum,
"Current year not included in the "
"copyright header",
None
]
if thisYear < start:
e[-1] = replaceCurrentYear(line, thisYear, end)
if thisYear > end:
Expand All @@ -103,8 +126,13 @@ def checkCopyright(f, update_current_year):
fp.close()
# copyright header itself not found
if not crFound:
e = [f, 0, "Copyright header missing or formatted incorrectly "
"(manual fix required)", None]
e = [
f,
0,
"Copyright header missing or formatted incorrectly "
"(manual fix required)",
None
]
errs.append(e)
# even if the year matches a copyright header, make the check pass
if yearMatched:
Expand All @@ -125,7 +153,6 @@ def checkCopyright(f, update_current_year):
return errs



def getAllFilesUnderDir(root, pathFilter=None):
retList = []
for (dirpath, dirnames, filenames) in os.walk(root):
Expand All @@ -143,25 +170,47 @@ def checkCopyright_main():
it compares between branches "$PR_TARGET_BRANCH" and "current-pr-branch"
"""
retVal = 0
global ExemptFiles

argparser = argparse.ArgumentParser(
description="Checks for a consistent copyright header")
argparser.add_argument("--update-current-year", dest='update_current_year',
action="store_true", required=False, help="If set, "
"update the current year if a header is already "
"present and well formatted.")
argparser.add_argument("--git-modified-only", dest='git_modified_only',
action="store_true", required=False, help="If set, "
"only files seen as modified by git will be "
"processed.")
"Checks for a consistent copyright header in git's modified files")
argparser.add_argument("--update-current-year",
dest='update_current_year',
action="store_true",
required=False,
help="If set, "
"update the current year if a header "
"is already present and well formatted.")
argparser.add_argument("--git-modified-only",
dest='git_modified_only',
action="store_true",
required=False,
help="If set, "
"only files seen as modified by git will be "
"processed.")
argparser.add_argument("--exclude",
dest='exclude',
action="append",
required=False,
default=["python/cuml/_thirdparty/"],
help=("Exclude the paths specified (regexp). "
"Can be specified multiple times."))

(args, dirs) = argparser.parse_known_args()
try:
ExemptFiles = ExemptFiles + [pathName for pathName in args.exclude]
ExemptFiles = [re.compile(file) for file in ExemptFiles]
except re.error as reException:
print("Regular expression error:")
print(reException)
return 1

if args.git_modified_only:
files = git_helpers.modifiedFiles(pathFilter=checkThisFile)
files = gitutils.modifiedFiles(pathFilter=checkThisFile)
else:
files = []
for d in [os.path.abspath(d) for d in dirs]:
if not(os.path.isdir(d)):
if not (os.path.isdir(d)):
raise ValueError(f"{d} is not a directory.")
files += getAllFilesUnderDir(d, pathFilter=checkThisFile)

Expand All @@ -178,8 +227,9 @@ def checkCopyright_main():
path_parts = os.path.abspath(__file__).split(os.sep)
file_from_repo = os.sep.join(path_parts[path_parts.index("ci"):])
if n_fixable > 0:
print("You can run {} --update-current-year to fix {} of these "
"errors.\n".format(file_from_repo, n_fixable))
print(("You can run `python {} --git-modified-only "
"--update-current-year` to fix {} of these "
"errors.\n").format(file_from_repo, n_fixable))
retVal = 1
else:
print("Copyright check passed")
Expand Down
1 change: 1 addition & 0 deletions conda/recipes/libcugraph/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ requirements:
run:
- {{ pin_compatible('cudatoolkit', max_pin='x', min_pin='x') }}
- libraft-headers {{ minor_version }}
- librmm {{ minor_version }}
- nccl>=2.9.9
- ucx-proc=*=gpu
- libcugraphops {{ minor_version }}.*
Expand Down
1 change: 1 addition & 0 deletions conda/recipes/libcugraph_etl/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ requirements:
- libcudf {{ minor_version }}.*
- libcugraph {{ minor_version }}.*
- libraft-headers {{ minor_version }}
- librmm {{ minor_version }}

about:
home: http://rapids.ai/
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake/thirdparty/get_libcugraphops.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function(find_and_configure_cugraphops)
endif()

rapids_find_generate_module(cugraphops
HEADER_NAMES graph/sampling.h
HEADER_NAMES graph/sampling.hpp
LIBRARY_NAMES cugraph-ops++
INCLUDE_SUFFIXES cugraph-ops
BUILD_EXPORT_SET cugraph-exports
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cugraph/visitors/enum_mapping.hpp
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cugraph/visitors/graph_enum.hpp
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cugraph/visitors/graph_envelope.hpp
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading