mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-29 14:16:31 +00:00
check-package: move parts to subdirectory
Currently the check-package script uses many files in the same directory. This commit keeps the main script in support/scripts/ and moves the rest into a subdirectory. The modules were previously prefixed to make it easy to identify which script they belong to. This is no longer needed when using a subdirectory, so the prefix is removed. Note: if this commit is checked out and the script is run, and later on a previous version is checked out, the file support/scripts/checkpackagelib/__init__.pyc needs to be manually removed to prevent Python interpreter to look for checkpackagelib package when only the checkpackagelib module is available. Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
parent
33481124c7
commit
7b394c4926
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# See support/scripts/check-package.txt before editing this file.
|
# See support/scripts/checkpackagelib/readme.txt before editing this file.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import argparse
|
import argparse
|
||||||
@ -7,10 +7,10 @@ import inspect
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import checkpackagelib_config
|
import checkpackagelib.lib_config
|
||||||
import checkpackagelib_hash
|
import checkpackagelib.lib_hash
|
||||||
import checkpackagelib_mk
|
import checkpackagelib.lib_mk
|
||||||
import checkpackagelib_patch
|
import checkpackagelib.lib_patch
|
||||||
|
|
||||||
VERBOSE_LEVEL_TO_SHOW_IGNORED_FILES = 3
|
VERBOSE_LEVEL_TO_SHOW_IGNORED_FILES = 3
|
||||||
flags = None # Command line arguments.
|
flags = None # Command line arguments.
|
||||||
@ -48,13 +48,13 @@ def get_lib_from_filename(fname):
|
|||||||
if FILE_IS_FROM_A_PACKAGE.search(fname) is None:
|
if FILE_IS_FROM_A_PACKAGE.search(fname) is None:
|
||||||
return None
|
return None
|
||||||
if CONFIG_IN_FILENAME.search(fname):
|
if CONFIG_IN_FILENAME.search(fname):
|
||||||
return checkpackagelib_config
|
return checkpackagelib.lib_config
|
||||||
if fname.endswith(".hash"):
|
if fname.endswith(".hash"):
|
||||||
return checkpackagelib_hash
|
return checkpackagelib.lib_hash
|
||||||
if fname.endswith(".mk"):
|
if fname.endswith(".mk"):
|
||||||
return checkpackagelib_mk
|
return checkpackagelib.lib_mk
|
||||||
if fname.endswith(".patch"):
|
if fname.endswith(".patch"):
|
||||||
return checkpackagelib_patch
|
return checkpackagelib.lib_patch
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
0
support/scripts/checkpackagelib/__init__.py
Normal file
0
support/scripts/checkpackagelib/__init__.py
Normal file
@ -1,4 +1,4 @@
|
|||||||
# See support/scripts/check-package.txt before editing this file.
|
# See support/scripts/checkpackagelib/readme.txt before editing this file.
|
||||||
|
|
||||||
|
|
||||||
class _CheckFunction(object):
|
class _CheckFunction(object):
|
@ -1,6 +1,6 @@
|
|||||||
# See support/scripts/check-package.txt before editing this file.
|
# See support/scripts/checkpackagelib/readme.txt before editing this file.
|
||||||
|
|
||||||
from checkpackagebase import _CheckFunction
|
from base import _CheckFunction
|
||||||
|
|
||||||
|
|
||||||
class ConsecutiveEmptyLines(_CheckFunction):
|
class ConsecutiveEmptyLines(_CheckFunction):
|
@ -1,16 +1,16 @@
|
|||||||
# See support/scripts/check-package.txt before editing this file.
|
# See support/scripts/checkpackagelib/readme.txt before editing this file.
|
||||||
# Kconfig generates errors if someone introduces a typo like "boool" instead of
|
# Kconfig generates errors if someone introduces a typo like "boool" instead of
|
||||||
# "bool", so below check functions don't need to check for things already
|
# "bool", so below check functions don't need to check for things already
|
||||||
# checked by running "make menuconfig".
|
# checked by running "make menuconfig".
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from checkpackagebase import _CheckFunction
|
from base import _CheckFunction
|
||||||
# Notice: ignore 'imported but unused' from pyflakes for check functions.
|
# Notice: ignore 'imported but unused' from pyflakes for check functions.
|
||||||
from checkpackagelib import ConsecutiveEmptyLines
|
from lib import ConsecutiveEmptyLines
|
||||||
from checkpackagelib import EmptyLastLine
|
from lib import EmptyLastLine
|
||||||
from checkpackagelib import NewlineAtEof
|
from lib import NewlineAtEof
|
||||||
from checkpackagelib import TrailingSpace
|
from lib import TrailingSpace
|
||||||
|
|
||||||
|
|
||||||
def _empty_or_comment(text):
|
def _empty_or_comment(text):
|
@ -1,16 +1,16 @@
|
|||||||
# See support/scripts/check-package.txt before editing this file.
|
# See support/scripts/checkpackagelib/readme.txt before editing this file.
|
||||||
# The validity of the hashes itself is checked when building, so below check
|
# The validity of the hashes itself is checked when building, so below check
|
||||||
# functions don't need to check for things already checked by running
|
# functions don't need to check for things already checked by running
|
||||||
# "make package-dirclean package-source".
|
# "make package-dirclean package-source".
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from checkpackagebase import _CheckFunction
|
from base import _CheckFunction
|
||||||
# Notice: ignore 'imported but unused' from pyflakes for check functions.
|
# Notice: ignore 'imported but unused' from pyflakes for check functions.
|
||||||
from checkpackagelib import ConsecutiveEmptyLines
|
from lib import ConsecutiveEmptyLines
|
||||||
from checkpackagelib import EmptyLastLine
|
from lib import EmptyLastLine
|
||||||
from checkpackagelib import NewlineAtEof
|
from lib import NewlineAtEof
|
||||||
from checkpackagelib import TrailingSpace
|
from lib import TrailingSpace
|
||||||
|
|
||||||
|
|
||||||
def _empty_line_or_comment(text):
|
def _empty_line_or_comment(text):
|
@ -1,4 +1,4 @@
|
|||||||
# See support/scripts/check-package.txt before editing this file.
|
# See support/scripts/checkpackagelib/readme.txt before editing this file.
|
||||||
# There are already dependency checks during the build, so below check
|
# There are already dependency checks during the build, so below check
|
||||||
# functions don't need to check for things already checked by exploring the
|
# functions don't need to check for things already checked by exploring the
|
||||||
# menu options using "make menuconfig" and by running "make" with appropriate
|
# menu options using "make menuconfig" and by running "make" with appropriate
|
||||||
@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from checkpackagebase import _CheckFunction
|
from base import _CheckFunction
|
||||||
# Notice: ignore 'imported but unused' from pyflakes for check functions.
|
# Notice: ignore 'imported but unused' from pyflakes for check functions.
|
||||||
from checkpackagelib import ConsecutiveEmptyLines
|
from lib import ConsecutiveEmptyLines
|
||||||
from checkpackagelib import EmptyLastLine
|
from lib import EmptyLastLine
|
||||||
from checkpackagelib import NewlineAtEof
|
from lib import NewlineAtEof
|
||||||
from checkpackagelib import TrailingSpace
|
from lib import TrailingSpace
|
||||||
|
|
||||||
|
|
||||||
class Indent(_CheckFunction):
|
class Indent(_CheckFunction):
|
@ -1,13 +1,13 @@
|
|||||||
# See support/scripts/check-package.txt before editing this file.
|
# See support/scripts/checkpackagelib/readme.txt before editing this file.
|
||||||
# The format of the patch files is tested during the build, so below check
|
# The format of the patch files is tested during the build, so below check
|
||||||
# functions don't need to check for things already checked by running
|
# functions don't need to check for things already checked by running
|
||||||
# "make package-dirclean package-patch".
|
# "make package-dirclean package-patch".
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from checkpackagebase import _CheckFunction
|
from base import _CheckFunction
|
||||||
# Notice: ignore 'imported but unused' from pyflakes for check functions.
|
# Notice: ignore 'imported but unused' from pyflakes for check functions.
|
||||||
from checkpackagelib import NewlineAtEof
|
from lib import NewlineAtEof
|
||||||
|
|
||||||
|
|
||||||
class ApplyOrder(_CheckFunction):
|
class ApplyOrder(_CheckFunction):
|
@ -8,8 +8,8 @@ How the scripts are structured:
|
|||||||
of variables (for the case it needs to keep data across calls) and the
|
of variables (for the case it needs to keep data across calls) and the
|
||||||
equivalent finalization (e.g. for the case a warning must be issued if some
|
equivalent finalization (e.g. for the case a warning must be issued if some
|
||||||
pattern is not in the input file).
|
pattern is not in the input file).
|
||||||
- checkpackagebase.py contains the base class for all check functions.
|
- base.py contains the base class for all check functions.
|
||||||
- checkpackagelib.py contains the classes for common check functions.
|
- lib.py contains the classes for common check functions.
|
||||||
Each check function is explicitly included in a given type-parsing library.
|
Each check function is explicitly included in a given type-parsing library.
|
||||||
Do not include every single check function in this file, a class that will
|
Do not include every single check function in this file, a class that will
|
||||||
only parse hash files should be implemented in the hash-parsing library.
|
only parse hash files should be implemented in the hash-parsing library.
|
||||||
@ -20,8 +20,7 @@ How the scripts are structured:
|
|||||||
first and second warnings are printed; when called with -vv until the third
|
first and second warnings are printed; when called with -vv until the third
|
||||||
warning is printed; an so on.
|
warning is printed; an so on.
|
||||||
Helper functions can be defined and will not be called by the main script.
|
Helper functions can be defined and will not be called by the main script.
|
||||||
- checkpackagelib_type.py contains check functions specific to files of this
|
- lib_type.py contains check functions specific to files of this type.
|
||||||
type.
|
|
||||||
|
|
||||||
Some hints when changing this code:
|
Some hints when changing this code:
|
||||||
- prefer O(n) algorithms, where n is the total number of lines in the files
|
- prefer O(n) algorithms, where n is the total number of lines in the files
|
Loading…
x
Reference in New Issue
Block a user