Skip to content

Commit f54346b

Browse files
committed
Fix style and copyrights
1 parent 000e865 commit f54346b

File tree

4 files changed

+71
-20
lines changed

4 files changed

+71
-20
lines changed

graalpython/com.oracle.graal.python.cext/include/common/runtime/ctx_tracker.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/* MIT License
2+
*
3+
* Copyright (c) 2021, Oracle and/or its affiliates.
4+
* Copyright (c) 2019 pyhandle
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
125
#ifndef HPY_COMMON_RUNTIME_CTX_TRACKER_H
226
#define HPY_COMMON_RUNTIME_CTX_TRACKER_H
327

graalpython/lib-graalpython/modules/hpy/test/test_tracker.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2021, Oracle and/or its affiliates.
4+
# Copyright (c) 2019 pyhandle
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
124
"""
225
NOTE: this tests are also meant to be run as PyPy "applevel" tests.
326

mx.graalpython/copyrights/overrides

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ graalpython/com.oracle.graal.python.cext/include/common/runtime/ctx_module.h,hpy
8080
graalpython/com.oracle.graal.python.cext/include/common/runtime/ctx_tuplebuilder.h,hpy.copyright
8181
graalpython/com.oracle.graal.python.cext/include/common/runtime/ctx_tuple.h,hpy.copyright
8282
graalpython/com.oracle.graal.python.cext/include/common/runtime/ctx_type.h,hpy.copyright
83+
graalpython/com.oracle.graal.python.cext/include/common/runtime/ctx_tracker.h,hpy.copyright
8384
graalpython/com.oracle.graal.python.cext/include/common/version.h,hpy.copyright
8485
graalpython/com.oracle.graal.python.cext/include/compile.h,python.copyright
8586
graalpython/com.oracle.graal.python.cext/include/complexobject.h,python.copyright
@@ -557,13 +558,15 @@ graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/sequence
557558
graalpython/lib-graalpython/_collections.py,pypy.copyright
558559
graalpython/lib-graalpython/_io.py,pypy.copyright
559560
graalpython/lib-graalpython/itertools.py,pypy.copyright
560-
graalpython/lib-graalpython/modules/hpy/devel.py,hpy.copyright
561-
graalpython/lib-graalpython/modules/hpy/src/runtime/argparse.c,hpy.copyright
562-
graalpython/lib-graalpython/modules/hpy/src/runtime/ctx_listbuilder.c,hpy.copyright
563-
graalpython/lib-graalpython/modules/hpy/src/runtime/ctx_module.c,hpy.copyright
564-
graalpython/lib-graalpython/modules/hpy/src/runtime/ctx_tuple.c,hpy.copyright
565-
graalpython/lib-graalpython/modules/hpy/src/runtime/ctx_tuplebuilder.c,hpy.copyright
566-
graalpython/lib-graalpython/modules/hpy/src/runtime/ctx_type.c,hpy.copyright
561+
graalpython/lib-graalpython/modules/hpy/devel/__init__.py,hpy.copyright
562+
graalpython/lib-graalpython/modules/hpy/devel/src/runtime/argparse.c,hpy.copyright
563+
graalpython/lib-graalpython/modules/hpy/devel/src/runtime/ctx_listbuilder.c,hpy.copyright
564+
graalpython/lib-graalpython/modules/hpy/devel/src/runtime/ctx_module.c,hpy.copyright
565+
graalpython/lib-graalpython/modules/hpy/devel/src/runtime/ctx_tracker.c,hpy.copyright
566+
graalpython/lib-graalpython/modules/hpy/devel/src/runtime/ctx_tuple.c,hpy.copyright
567+
graalpython/lib-graalpython/modules/hpy/devel/src/runtime/ctx_tuplebuilder.c,hpy.copyright
568+
graalpython/lib-graalpython/modules/hpy/devel/src/runtime/ctx_type.c,hpy.copyright
569+
graalpython/lib-graalpython/modules/hpy/devel/version.py,hpy.copyright
567570
graalpython/lib-graalpython/modules/hpy/test/__init__.py,hpy.copyright
568571
graalpython/lib-graalpython/modules/hpy/test/check_py27_compat.py,hpy.copyright
569572
graalpython/lib-graalpython/modules/hpy/test/conftest.py,hpy.copyright
@@ -584,7 +587,7 @@ graalpython/lib-graalpython/modules/hpy/test/test_number.py,hpy.copyright
584587
graalpython/lib-graalpython/modules/hpy/test/test_object.py,hpy.copyright
585588
graalpython/lib-graalpython/modules/hpy/test/test_slots.py,hpy.copyright
586589
graalpython/lib-graalpython/modules/hpy/test/test_support.py,hpy.copyright
587-
graalpython/lib-graalpython/modules/hpy/version.py,hpy.copyright
590+
graalpython/lib-graalpython/modules/hpy/test/test_tracker.py,hpy.copyright
588591
graalpython/lib-graalpython/object.py,pypy.copyright
589592
graalpython/lib-graalpython/str.py,pypy.copyright
590593
graalpython/lib-graalpython/timsort.py,pypy.copyright

mx.graalpython/mx_graalpython.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,54 +2019,55 @@ def import_files(from_dir, to_dir):
20192019
dest_file = join(to_dir, relative_dir_path, filename)
20202020
import_file(src_file, dest_file)
20212021

2022-
def remove_inexisting_file(src_file, dest_file):
2022+
def remove_inexistent_file(src_file, dest_file):
20232023
if not os.path.exists(dest_file):
20242024
mx.logv("Removing file {} since {} does not exist".format(src_file, dest_file))
20252025
vc.git_command(SUITE.dir, ["rm", src_file])
20262026

2027-
def remove_inexisting_files(hpy_dir, our_dir):
2027+
def remove_inexistent_files(hpy_dir, our_dir):
20282028
mx.log("Looking for removed files in {} (HPy reference dir {})".format(our_dir, hpy_dir))
20292029
for dirpath, _, filenames in os.walk(our_dir):
20302030
relative_dir_path = os.path.relpath(dirpath, start=our_dir)
20312031
for filename in filenames:
20322032
src_file = join(dirpath, filename)
20332033
dest_file = join(hpy_dir, relative_dir_path, filename)
2034-
remove_inexisting_file(src_file, dest_file)
2034+
remove_inexistent_file(src_file, dest_file)
20352035

20362036
# headers go into 'com.oracle.graal.python.cext/include'
20372037
header_dest = join(mx.dependency("com.oracle.graal.python.cext").dir, "include")
20382038

20392039
# copy headers from .../hpy/hpy/devel/include' to 'header_dest'
20402040
# but exclude subdir 'cpython' (since that's only for CPython)
20412041
import_files(hpy_repo_include_dir, header_dest)
2042-
remove_inexisting_files(hpy_repo_include_dir, header_dest)
2042+
remove_inexistent_files(hpy_repo_include_dir, header_dest)
20432043

20442044
# runtime sources go into 'lib-graalpython/module/hpy/devel/src'
20452045
runtime_files_dest = join(_get_core_home(), "modules", "hpy", "devel", "src")
20462046
import_files(hpy_repo_runtime_dir, runtime_files_dest)
2047-
remove_inexisting_files(hpy_repo_runtime_dir, runtime_files_dest)
2047+
remove_inexistent_files(hpy_repo_runtime_dir, runtime_files_dest)
20482048

20492049
# tests go to 'lib-graalpython/module/hpy/tests'
20502050
test_files_dest = _hpy_test_root()
20512051
import_files(hpy_repo_test_dir, test_files_dest)
2052-
remove_inexisting_files(hpy_repo_test_dir, test_files_dest)
2052+
remove_inexistent_files(hpy_repo_test_dir, test_files_dest)
20532053

20542054
# 'version.py' goes to 'lib-graalpython/module/hpy/devel/'
20552055
dest_version_file = join(_get_core_home(), "modules", "hpy", "devel", "version.py")
20562056
import_file(join(hpy_repo_path, "hpy", "devel", "version.py"), dest_version_file)
20572057

2058-
# read version from 'version.py'
2059-
with open(dest_version_file, "r") as f:
2060-
dummy_globals = {}
2061-
exec(f.read(), dummy_globals)
2062-
imported_version = dummy_globals["__version__"]
2058+
# import 'version.py' by path and read '__version__'
2059+
from importlib import util
2060+
spec = util.spec_from_file_location("version", dest_version_file)
2061+
version_module = util.module_from_spec(spec)
2062+
spec.loader.exec_module(version_module)
2063+
imported_version = version_module.__version__
20632064

20642065
SUITE.vc.git_command(SUITE.dir, ["add", header_dest, runtime_files_dest, test_files_dest])
20652066
raw_input("Check that the updated files look as intended, then press RETURN...")
20662067
SUITE.vc.commit(SUITE.dir, "Update HPy inlined files: %s" % import_version)
20672068
SUITE.vc.git_command(SUITE.dir, ["checkout", "-"])
20682069
SUITE.vc.git_command(SUITE.dir, ["merge", HPY_IMPORT_ORPHAN_BRANCH_NAME])
2069-
2070+
20702071
# update PKG-INFO version
20712072
pkg_info_file = join(_get_core_home(), "modules", "hpy.devel.egg-info", "PKG-INFO")
20722073
with open(pkg_info_file, "w") as f:

0 commit comments

Comments
 (0)