Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
31a4f0ab
Commit
31a4f0ab
authored
May 09, 2016
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement website update script
parent
744c2824
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
22 deletions
+43
-22
doc/build.py
doc/build.py
+4
-2
support/update-website.py
support/update-website.py
+39
-20
No files found.
doc/build.py
View file @
31a4f0ab
...
...
@@ -51,7 +51,9 @@ def create_build_env():
pip_install
(
'michaeljones/breathe'
,
'1c9d7f80378a92cffa755084823a78bb38ee4acc'
)
def
build_docs
(
version
=
'dev'
,
doc_dir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))):
def
build_docs
(
version
=
'dev'
,
**
kwargs
):
doc_dir
=
kwargs
.
get
(
'doc_dir'
,
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)))
include_dir
=
kwargs
.
get
(
'include_dir'
,
os
.
path
.
join
(
os
.
path
.
dirname
(
doc_dir
),
'fmt'
))
# Build docs.
cmd
=
[
'doxygen'
,
'-'
]
p
=
Popen
(
cmd
,
stdin
=
PIPE
)
...
...
@@ -77,7 +79,7 @@ def build_docs(version='dev', doc_dir=os.path.dirname(os.path.realpath(__file__)
FMT_USE_USER_DEFINED_LITERALS=1 \
FMT_API=
EXCLUDE_SYMBOLS = fmt::internal::* StringValue write_str
'''
.
format
(
os
.
path
.
join
(
os
.
path
.
dirname
(
doc_dir
),
'fmt'
)
).
encode
(
'UTF-8'
))
'''
.
format
(
include_dir
).
encode
(
'UTF-8'
))
if
p
.
returncode
!=
0
:
raise
CalledProcessError
(
p
.
returncode
,
cmd
)
check_call
([
'sphinx-build'
,
...
...
support/update-website.py
View file @
31a4f0ab
#!/usr/bin/env python
import
os
,
shutil
,
sys
import
os
,
shutil
,
sys
,
tempfile
from
subprocess
import
check_call
class
Git
:
...
...
@@ -22,22 +22,41 @@ sys.path.insert(0, os.path.join(fmt_dir, 'doc'))
import
build
build
.
create_build_env
()
git
=
Git
(
'fmt'
)
git
.
clone
(
'git@github.com:fmtlib/fmt.git'
)
versions
=
[
'1.0.0'
]
for
version
in
versions
:
git
.
checkout
(
version
)
target_doc_dir
=
os
.
path
.
join
(
git
.
dir
,
'doc'
)
# Remove the old theme.
for
entry
in
os
.
listdir
(
target_doc_dir
):
path
=
os
.
path
.
join
(
target_doc_dir
,
entry
)
if
os
.
path
.
isdir
(
path
):
shutil
.
rmtree
(
path
)
# Copy the new theme.
for
entry
in
[
'_static'
,
'_templates'
,
'basic-bootstrap'
,
'bootstrap'
]:
src
=
os
.
path
.
join
(
fmt_dir
,
'doc'
,
entry
)
dst
=
os
.
path
.
join
(
target_doc_dir
,
entry
)
shutil
.
copytree
(
src
,
dst
)
build
.
build_docs
(
version
,
target_doc_dir
)
# TODO: copy docs to website
fmt_repo
=
Git
(
tempfile
.
mkdtemp
(
'fmt'
))
try
:
fmt_repo
.
clone
(
'git@github.com:fmtlib/fmt'
)
doc_repo
=
Git
(
'fmtlib.github.io'
)
doc_repo
.
clone
(
'git@github.com:fmtlib/fmtlib.github.io'
)
versions
=
[
'1.0.0'
]
for
version
in
versions
:
fmt_repo
.
checkout
(
version
)
target_doc_dir
=
os
.
path
.
join
(
fmt_repo
.
dir
,
'doc'
)
# Remove the old theme.
for
entry
in
os
.
listdir
(
target_doc_dir
):
path
=
os
.
path
.
join
(
target_doc_dir
,
entry
)
if
os
.
path
.
isdir
(
path
):
shutil
.
rmtree
(
path
)
# Copy the new theme.
for
entry
in
[
'_static'
,
'_templates'
,
'basic-bootstrap'
,
'bootstrap'
,
'conf.py'
,
'fmt.less'
]:
src
=
os
.
path
.
join
(
fmt_dir
,
'doc'
,
entry
)
dst
=
os
.
path
.
join
(
target_doc_dir
,
entry
)
copy
=
shutil
.
copytree
if
os
.
path
.
isdir
(
src
)
else
shutil
.
copyfile
copy
(
src
,
dst
)
# Rename index to contents.
contents
=
os
.
path
.
join
(
target_doc_dir
,
'contents.rst'
)
if
not
os
.
path
.
exists
(
contents
):
os
.
rename
(
os
.
path
.
join
(
target_doc_dir
,
'index.rst'
),
contents
)
# Build the docs.
build
.
build_docs
(
version
,
doc_dir
=
target_doc_dir
,
include_dir
=
fmt_repo
.
dir
)
# Create symlinks for older versions.
for
link
,
target
in
{
'index'
:
'contents'
,
'api'
:
'reference'
}.
items
():
os
.
symlink
(
target
+
'.html'
,
os
.
path
.
join
(
'html'
,
link
)
+
'.html'
)
# Copy docs to the website.
version_doc_dir
=
os
.
path
.
join
(
doc_repo
.
dir
,
version
)
shutil
.
rmtree
(
version_doc_dir
)
shutil
.
copytree
(
'html'
,
version_doc_dir
,
symlinks
=
True
)
# TODO: fix links
# TODO: remove doc repo
except
:
shutil
.
rmtree
(
fmt_repo
.
dir
)
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