Skip to content

Commit cef4924

Browse files
authored
Updating a few headers that have been renamed in raft (#2090)
Authors: - Corey J. Nolet (https://github.com/cjnolet) - Rick Ratzel (https://github.com/rlratzel) Approvers: - Chuck Hastings (https://github.com/ChuckHastings) - Jordan Jacobelli (https://github.com/Ethyling) URL: #2090
1 parent f7eea32 commit cef4924

File tree

15 files changed

+384
-46
lines changed

15 files changed

+384
-46
lines changed

ci/checks/copyright.py

Lines changed: 79 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019-2021, NVIDIA CORPORATION.
1+
# Copyright (c) 2020-2022, NVIDIA CORPORATION.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -18,7 +18,17 @@
1818
import argparse
1919
import io
2020
import os
21-
import git_helpers
21+
import sys
22+
23+
SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.expanduser(__file__)))
24+
25+
# Add the scripts dir for gitutils
26+
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR,
27+
"../../cpp/scripts")))
28+
29+
# Now import gitutils. Ignore flake8 error here since there is no other way to
30+
# set up imports
31+
import gitutils # noqa: E402
2232

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

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

3750

3851
def checkThisFile(f):
3952
# This check covers things like symlinks which point to files that DNE
40-
if not(os.path.exists(f)):
53+
if not (os.path.exists(f)):
4154
return False
42-
if git_helpers and git_helpers.isFileEmpty(f):
43-
return False
44-
# Special case for versioneer.py - it uses a separate copyright.
45-
if os.path.basename(f) == "versioneer.py":
55+
if gitutils and gitutils.isFileEmpty(f):
4656
return False
57+
for exempt in ExemptFiles:
58+
if exempt.search(f):
59+
return False
4760
for checker in FilesToCheck:
4861
if checker.search(f):
4962
return True
@@ -87,12 +100,22 @@ def checkCopyright(f, update_current_year):
87100
continue
88101
crFound = True
89102
if start > end:
90-
e = [f, lineNum, "First year after second year in the copyright "
91-
"header (manual fix required)", None]
103+
e = [
104+
f,
105+
lineNum,
106+
"First year after second year in the copyright "
107+
"header (manual fix required)",
108+
None
109+
]
92110
errs.append(e)
93111
if thisYear < start or thisYear > end:
94-
e = [f, lineNum, "Current year not included in the "
95-
"copyright header", None]
112+
e = [
113+
f,
114+
lineNum,
115+
"Current year not included in the "
116+
"copyright header",
117+
None
118+
]
96119
if thisYear < start:
97120
e[-1] = replaceCurrentYear(line, thisYear, end)
98121
if thisYear > end:
@@ -103,8 +126,13 @@ def checkCopyright(f, update_current_year):
103126
fp.close()
104127
# copyright header itself not found
105128
if not crFound:
106-
e = [f, 0, "Copyright header missing or formatted incorrectly "
107-
"(manual fix required)", None]
129+
e = [
130+
f,
131+
0,
132+
"Copyright header missing or formatted incorrectly "
133+
"(manual fix required)",
134+
None
135+
]
108136
errs.append(e)
109137
# even if the year matches a copyright header, make the check pass
110138
if yearMatched:
@@ -125,7 +153,6 @@ def checkCopyright(f, update_current_year):
125153
return errs
126154

127155

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

147175
argparser = argparse.ArgumentParser(
148-
description="Checks for a consistent copyright header")
149-
argparser.add_argument("--update-current-year", dest='update_current_year',
150-
action="store_true", required=False, help="If set, "
151-
"update the current year if a header is already "
152-
"present and well formatted.")
153-
argparser.add_argument("--git-modified-only", dest='git_modified_only',
154-
action="store_true", required=False, help="If set, "
155-
"only files seen as modified by git will be "
156-
"processed.")
176+
"Checks for a consistent copyright header in git's modified files")
177+
argparser.add_argument("--update-current-year",
178+
dest='update_current_year',
179+
action="store_true",
180+
required=False,
181+
help="If set, "
182+
"update the current year if a header "
183+
"is already present and well formatted.")
184+
argparser.add_argument("--git-modified-only",
185+
dest='git_modified_only',
186+
action="store_true",
187+
required=False,
188+
help="If set, "
189+
"only files seen as modified by git will be "
190+
"processed.")
191+
argparser.add_argument("--exclude",
192+
dest='exclude',
193+
action="append",
194+
required=False,
195+
default=["python/cuml/_thirdparty/"],
196+
help=("Exclude the paths specified (regexp). "
197+
"Can be specified multiple times."))
157198

158199
(args, dirs) = argparser.parse_known_args()
200+
try:
201+
ExemptFiles = ExemptFiles + [pathName for pathName in args.exclude]
202+
ExemptFiles = [re.compile(file) for file in ExemptFiles]
203+
except re.error as reException:
204+
print("Regular expression error:")
205+
print(reException)
206+
return 1
207+
159208
if args.git_modified_only:
160-
files = git_helpers.modifiedFiles(pathFilter=checkThisFile)
209+
files = gitutils.modifiedFiles(pathFilter=checkThisFile)
161210
else:
162211
files = []
163212
for d in [os.path.abspath(d) for d in dirs]:
164-
if not(os.path.isdir(d)):
213+
if not (os.path.isdir(d)):
165214
raise ValueError(f"{d} is not a directory.")
166215
files += getAllFilesUnderDir(d, pathFilter=checkThisFile)
167216

@@ -178,8 +227,9 @@ def checkCopyright_main():
178227
path_parts = os.path.abspath(__file__).split(os.sep)
179228
file_from_repo = os.sep.join(path_parts[path_parts.index("ci"):])
180229
if n_fixable > 0:
181-
print("You can run {} --update-current-year to fix {} of these "
182-
"errors.\n".format(file_from_repo, n_fixable))
230+
print(("You can run `python {} --git-modified-only "
231+
"--update-current-year` to fix {} of these "
232+
"errors.\n").format(file_from_repo, n_fixable))
183233
retVal = 1
184234
else:
185235
print("Copyright check passed")

conda/recipes/libcugraph/meta.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ requirements:
4949
run:
5050
- {{ pin_compatible('cudatoolkit', max_pin='x', min_pin='x') }}
5151
- libraft-headers {{ minor_version }}
52+
- librmm {{ minor_version }}
5253
- nccl>=2.9.9
5354
- ucx-proc=*=gpu
5455
- libcugraphops {{ minor_version }}.*

conda/recipes/libcugraph_etl/meta.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ requirements:
4545
- libcudf {{ minor_version }}.*
4646
- libcugraph {{ minor_version }}.*
4747
- libraft-headers {{ minor_version }}
48+
- librmm {{ minor_version }}
4849

4950
about:
5051
home: http://rapids.ai/

cpp/include/cugraph/visitors/enum_mapping.hpp

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, NVIDIA CORPORATION.
2+
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

cpp/include/cugraph/visitors/graph_enum.hpp

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, NVIDIA CORPORATION.
2+
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

cpp/include/cugraph/visitors/graph_envelope.hpp

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, NVIDIA CORPORATION.
2+
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)