Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Lesson Template
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
prace-lessons
Lesson Template
Commits
71fbc897
Commit
71fbc897
authored
8 years ago
by
Greg Wilson
Browse files
Options
Downloads
Patches
Plain Diff
Converting required files to dictionary
parent
988bc7c3
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/lesson_check.py
+18
-19
18 additions, 19 deletions
bin/lesson_check.py
with
18 additions
and
19 deletions
bin/lesson_check.py
+
18
−
19
View file @
71fbc897
...
...
@@ -17,26 +17,25 @@ from util import Reporter
__version__
=
'
0.2
'
# Where to look for source Markdown files.
SOURCE_DIRS
=
[
''
,
'
_episodes
'
,
'
_extras
'
]
# Required files: each item is a tuple of (YAML_required, path).
# FIXME: We do not yet validate whether any files have the required
# YAML headers, but should in the future.
# Required files: each entry is 'path_pattern: YAML_required'.
# The '%' is replaced with the source directory path for checking.
# Episodes are handled specially, and extra files in '_extras' are also handled specially.
# This list must include all the Markdown files listed in the 'bin/initialize' script.
REQUIRED_FILES
=
[
(
True
,
'
%/CONDUCT.md
'
),
(
False
,
'
%/CONTRIBUTING.md
'
),
(
True
,
'
%/LICENSE.md
'
),
(
False
,
'
%/README.md
'
),
(
True
,
'
%/_extras/discuss.md
'
),
(
True
,
'
%/_extras/guide.md
'
),
(
True
,
'
%/index.md
'
),
(
True
,
'
%/reference.md
'
),
(
True
,
'
%/setup.md
'
)
]
# This list must include all the Markdown files listed in the 'bin/lesson_initialize.py' script.
REQUIRED_FILES
=
{
'
%/CONDUCT.md
'
:
True
,
'
%/CONTRIBUTING.md
'
:
False
,
'
%/LICENSE.md
'
:
True
,
'
%/README.md
'
:
False
,
'
%/_extras/discuss.md
'
:
True
,
'
%/_extras/guide.md
'
:
True
,
'
%/index.md
'
:
True
,
'
%/reference.md
'
:
True
,
'
%/setup.md
'
:
True
}
# Where to look for source Markdown files.
# FIXME: should derive this from REQUIRED_FILES.
SOURCE_DIRS
=
[
''
,
'
_episodes
'
,
'
_extras
'
]
# Episode filename pattern.
P_EPISODE_FILENAME
=
re
.
compile
(
r
'
/_episodes/(\d\d)-[-\w]+.md$
'
)
...
...
@@ -178,7 +177,7 @@ def check_fileset(source_dir, reporter, filenames_present):
"""
Are all required files present? Are extraneous files present?
"""
# Check files with predictable names.
required
=
[
p
[
1
]
.
replace
(
'
%
'
,
source_dir
)
for
p
in
REQUIRED_FILES
]
required
=
[
p
.
replace
(
'
%
'
,
source_dir
)
for
p
in
REQUIRED_FILES
]
missing
=
set
(
required
)
-
set
(
filenames_present
)
for
m
in
missing
:
reporter
.
add
(
m
,
'
Missing required file
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment