Skip to content

Commit

Permalink
Add copyright and spell check tests
Browse files Browse the repository at this point in the history
Signed-off-by: Víctor Mayoral Vilches <[email protected]>
  • Loading branch information
vmayoral committed Mar 24, 2022
1 parent 5616e40 commit 3e69285
Show file tree
Hide file tree
Showing 21 changed files with 142 additions and 194 deletions.
13 changes: 2 additions & 11 deletions colcon_acceleration/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

__version__ = "0.4.0"
15 changes: 3 additions & 12 deletions colcon_acceleration/subverb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

import os
import subprocess
import sys
Expand Down Expand Up @@ -896,7 +887,7 @@ def copy_libstdcppfs(partition=2): # noqa: D102

def create_ros2_overlay_script(): # noqa: D102
"""
Creates common /opt/ros/foxy/setup.bash script on the go
Creates common /opt/ros/<ROS distro>/setup.bash script on the go
return: path to the script just created under /tmp (/tmp/setup.bash)
"""
Expand Down
13 changes: 2 additions & 11 deletions colcon_acceleration/subverb/board.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

import os

from colcon_core.plugin_system import satisfies_version
Expand Down
13 changes: 2 additions & 11 deletions colcon_acceleration/subverb/emulation.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

import os
import sys

Expand Down
13 changes: 2 additions & 11 deletions colcon_acceleration/subverb/hls.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

import os
import sys

Expand Down
13 changes: 2 additions & 11 deletions colcon_acceleration/subverb/hypervisor.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

import os
import sys
import errno
Expand Down
13 changes: 2 additions & 11 deletions colcon_acceleration/subverb/linux.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

import os
import sys
import errno
Expand Down
15 changes: 2 additions & 13 deletions colcon_acceleration/subverb/list.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

# list hardware acceleration technology solutions available

import os

from colcon_core.plugin_system import satisfies_version
Expand All @@ -27,7 +16,7 @@

def get_firmware_options():
"""Search the workspace for firmware options
Looks into "acceleration/firmware"
"""
current_dir = os.environ.get("PWD", "")
Expand Down
13 changes: 2 additions & 11 deletions colcon_acceleration/subverb/mkinitramfs.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

import os
import sys

Expand Down
13 changes: 2 additions & 11 deletions colcon_acceleration/subverb/mount.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

import os

from colcon_core.plugin_system import satisfies_version
Expand Down
13 changes: 2 additions & 11 deletions colcon_acceleration/subverb/platform.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

import os

from colcon_core.plugin_system import satisfies_version
Expand Down
11 changes: 1 addition & 10 deletions colcon_acceleration/subverb/select.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0

# select across the ROS 2 hardware acceleration firmware solutions available
Expand Down
13 changes: 2 additions & 11 deletions colcon_acceleration/subverb/umount.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

import sys

from colcon_core.plugin_system import satisfies_version
Expand Down
13 changes: 2 additions & 11 deletions colcon_acceleration/subverb/version.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

import os

from colcon_core.plugin_system import satisfies_version
Expand Down
13 changes: 2 additions & 11 deletions colcon_acceleration/subverb/vpp.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

import os
import sys

Expand Down
12 changes: 1 addition & 11 deletions colcon_acceleration/verb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

def black(text):
print("\033[30m", text, "\033[0m", sep="")
Expand Down
16 changes: 4 additions & 12 deletions colcon_acceleration/verb/acceleration.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: Víctor Mayoral Vilches <[email protected]>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0
#

from colcon_core.command import add_subparsers
from colcon_core.plugin_system import satisfies_version
from colcon_core.verb import VerbExtensionPoint
Expand All @@ -31,7 +22,8 @@ def add_arguments(self, *, parser): # noqa: D102
# get subverb extensions and let them add their arguments
subverb_extensions = get_subverb_extensions()
add_subparsers(
parser, "colcon acceleration", subverb_extensions, attribute="subverb_name"
parser, "colcon acceleration",
subverb_extensions, attribute="subverb_name"
)

def main(self, *, context): # noqa: D102
Expand Down
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Copyright (c) 2021, Xilinx®.
# All rights reserved
#
# Author: Víctor Mayoral Vilches <[email protected]>
# Copyright 2022 Víctor Mayoral-Vilches
# Licensed under the Apache License, Version 2.0

from setuptools import setup

Expand Down
10 changes: 10 additions & 0 deletions test/spell_check.words
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apache
colcon
iterdir
pathlib
pytest
scspell
setuptools
thomas
vilches
íctor
39 changes: 39 additions & 0 deletions test/test_copyright_license.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2016-2018 Dirk Thomas
# Licensed under the Apache License, Version 2.0

from pathlib import Path
import sys


def test_copyright_license():
missing = check_files([Path(__file__).parents[1]])
assert not len(missing), \
'In some files no copyright / license line was found'


def check_files(paths):
missing = []
for path in paths:
if path.is_dir():
for p in sorted(path.iterdir()):
if p.name.startswith('.'):
continue
if p.name.endswith('.py') or p.is_dir():
missing += check_files([p])
if path.is_file():
content = path.read_text()
if not content:
continue
lines = content.splitlines()
has_copyright = \
any(line for line in lines if line.startswith('# Copyright'))
has_license = \
'# Licensed under the Apache License, Version 2.0' in lines
if not has_copyright or not has_license:
print(
'Could not find copyright / license in:', path,
file=sys.stderr)
missing .append(path)
else:
print('Found copyright / license in:', path)
return missing
Loading

0 comments on commit 3e69285

Please sign in to comment.