Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Seitosh
csback
Commits
8e0b087e
Commit
8e0b087e
authored
Aug 01, 2019
by
thomas.forbriger
Committed by
Checksum Backup @bromo
Aug 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
csbackgen, csfile: capture regex syntax errors
parent
2de76cab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
csbackgen.py
csbackgen.py
+2
-0
csfile.py
csfile.py
+7
-2
No files found.
csbackgen.py
View file @
8e0b087e
...
...
@@ -39,6 +39,7 @@
# 28/02/2013 V0.7 improve error handling; use error codes
# 26/10/2013 V0.8 dry-run flag introduced
# 09/11/2013 V0.8.1 adjusted help text
# 01/08/2019 V0.8.2 (thof): provide additional debug output
#
# =============================================================================
...
...
@@ -294,6 +295,7 @@ def main(argv=None):
# generate checksumfiles for subdirectories (recursive mode)
# so collect all available subdirectories here (excluding subdirectories)
if
not
notRecursive
:
logger
.
getLogger
().
debug
(
"collect subdirectories
\n
srcpath: %s
\n
regexes: %s
\n
followlinks: %s"
%
(
srcpath
,
regexes
,
followlinks
))
dirs
.
extend
(
csfile
.
getSubDirectories
(
srcpath
,
regexes
,
followlinks
))
# if a target directory had been passed extend the list of
# target directories replacing the trunk of the source directory with the
...
...
csfile.py
View file @
8e0b087e
...
...
@@ -51,6 +51,8 @@
# files based on time stamp values) for open time windows
# (like all younger than 3 days), we use datetime.max as
# the end time
# 01/08/2019 V0.6.6 (thof) let getSubDirectories produce a reasonable error
# message, if application of a regex fails
#
# =============================================================================
""" CsFile module to handle checksumfiles. """
...
...
@@ -68,7 +70,7 @@ from datetime import date
import
csbacklog
import
csbackErrorCodes
as
eCodes
__version__
=
"V0.6.
5
"
__version__
=
"V0.6.
6
"
__subversion__
=
"$Id$"
__license__
=
"GPLv2+"
__author__
=
"Daniel Armbruster"
...
...
@@ -102,7 +104,10 @@ def getSubDirectories(path, regexes, followLinks=False):
subDirs
.
add
(
os
.
path
.
join
(
root
,
dir
))
# exclude directories matching regexes
for
regex
in
regexes
:
matching
=
set
(
dir
for
dir
in
subDirs
if
None
!=
re
.
match
(
regex
,
dir
))
try
:
matching
=
set
(
dir
for
dir
in
subDirs
if
None
!=
re
.
match
(
regex
,
dir
))
except
:
raise
CsFileError
(
"application of exclude regex %s failed!"
%
regex
,
eCodes
.
CSFILE_CollectingSubDirs
)
subDirs
-=
matching
except
OSError
as
err
:
raise
CsFileError
(
"[Errno "
+
str
(
err
.
errno
)
+
"] "
+
err
.
strerror
+
": "
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment