Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
c69170a6
Commit
c69170a6
authored
4 years ago
by
Pospelov, Gennady
Browse files
Options
Downloads
Patches
Plain Diff
Revise script for updating a web site
parent
34a2b1e4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dev-tools/code-tools/update-website.py
+29
-12
29 additions, 12 deletions
dev-tools/code-tools/update-website.py
with
29 additions
and
12 deletions
dev-tools/code-tools/update-website.py
+
29
−
12
View file @
c69170a6
...
...
@@ -15,10 +15,12 @@ TODO: move the script under ctest control
"""
import
os
import
shutil
import
click
WEBSITE_DIR
=
"
/home/pospelov/development/BornAgain-website
"
BORNAGAIN_SOURCE
=
"
/home/pospelov/development/BornAgainHub/BornAgain
"
EXAMPLE_IMAGES
=
"
/home/pospelov/development/BornAgainHub/build/test_output/Functional/Python/PyExamples
"
WEBSITE_DIR
=
"
~/development/BornAgain/BornAgain-website
"
BORNAGAIN_SOURCE
=
"
~/development/BornAgain/BornAgain
"
BUILD_DIR
=
"
~/development/BornAgain/build-release/
"
def
copy_file_to_file
(
source
,
destination
):
...
...
@@ -86,33 +88,48 @@ def copy_files(source_list, destination_list):
print
(
f
)
def
update_example_images
():
def
update_example_images
(
website_dir
,
example_images
):
"""
Copies example intensity images from build directory to website directory
"""
website
=
os
.
path
.
join
(
WEBSITE_DIR
,
"
content/documentation/
s
ample
-model
s
"
)
source
=
EXAMPLE_IMAGES
website
=
os
.
path
.
join
(
website_dir
,
"
content/documentation/
ex
amples
"
)
source
=
example_images
website_files
=
get_files
(
website
,
"
.png
"
)
source_files
=
get_files
(
source
,
"
.png
"
)
copy_files
(
source_files
,
website_files
)
def
update_example_scripts
():
def
update_example_scripts
(
website_dir
,
bornagain_source
):
"""
Copies example scripts from BornAgain directory to website directory
"""
website
=
os
.
path
.
join
(
WEBSITE_DIR
,
"
static/files/python
"
)
source
=
os
.
path
.
join
(
BORNAGAIN_SOURCE
,
"
Examples/python
"
)
website
=
os
.
path
.
join
(
website_dir
,
"
static/files/python
"
)
source
=
os
.
path
.
join
(
bornagain_source
,
"
Examples/python
"
)
website_files
=
get_files
(
website
,
"
.py
"
)
source_files
=
get_files
(
source
,
"
.py
"
)
print
(
website_files
)
copy_files
(
source_files
,
website_files
)
def
update_website
():
update_example_images
()
update_example_scripts
()
@click.command
()
@click.argument
(
"
website_dir
"
,
required
=
False
,
type
=
str
,
default
=
WEBSITE_DIR
)
@click.argument
(
"
bornagain_source
"
,
required
=
False
,
type
=
str
,
default
=
BORNAGAIN_SOURCE
)
@click.argument
(
"
build_dir
"
,
required
=
False
,
type
=
str
,
default
=
BUILD_DIR
)
def
update_website
(
website_dir
,
bornagain_source
,
build_dir
):
user_website_dir
=
os
.
path
.
expanduser
(
website_dir
)
user_bornagain_source
=
os
.
path
.
expanduser
(
bornagain_source
)
user_build_dir
=
os
.
path
.
expanduser
(
build_dir
)
user_example_images
=
os
.
path
.
join
(
user_build_dir
,
"
test_output/Functional/Python/PyExamples
"
)
print
(
"
website_dir :
'
{}
'"
.
format
(
user_website_dir
))
print
(
"
bornagain_source :
'
{}
'"
.
format
(
user_bornagain_source
))
print
(
"
build_dir :
'
{}
'"
.
format
(
user_build_dir
))
print
(
"
example_images :
'
{}
'"
.
format
(
user_example_images
))
update_example_images
(
user_website_dir
,
user_example_images
)
update_example_scripts
(
user_website_dir
,
user_bornagain_source
)
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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