Skip to content

Commit

Permalink
copy requirements.txt to site root, so users can get and install them…
Browse files Browse the repository at this point in the history
… in one command
  • Loading branch information
Fallen-Breath committed Feb 24, 2024
1 parent 2483540 commit 77c2165
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
11 changes: 11 additions & 0 deletions docs/build_hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import shutil
from pathlib import Path

HERE = Path(__file__).parent
REPOS_ROOT = HERE.parent


def on_post_build(config, **kwargs):
site_dir = Path(config['site_dir'])
for file in ['requirements.txt', 'requirements.optional.txt']:
shutil.copy(REPOS_ROOT / file, site_dir)
8 changes: 7 additions & 1 deletion docs/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ Prime Backup requires a few python libraries to run, they are all listed in the

Use command `pip3 install -r requirements.txt` to install all required Python requirements

You can also use the following command to install all required python packages for the latest Prime Backup in one step

```shell
pip3 install -r {{ config.site_url }}requirements.txt
```

### Optional requirements

Some Prime Backup features requires python libraries that does not listed in the requirements.txt,
Expand All @@ -36,7 +42,7 @@ because it might [take you some effort](https://github.com/oconnor663/blake3-py/
If you want to have full features of Prime Backup, you can use the following command in advanced:

```bash
pip3 install blake3 lz4
pip3 install -r {{ config.site_url }}requirements.optional.txt
```

These optional requirements are also stored in the [requirements.optional.txt](https://github.com/TISUnion/PrimeBackup/blob/master/requirements.optional.txt)
Expand Down
10 changes: 8 additions & 2 deletions docs/quick_start.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,21 @@ Prime Backup 需要一些 python 库才能运行,它们都被列在了

使用命令 `pip3 install -r requirements.txt` 即可安装所有需要的 Python 依赖

除此之外,你也可以使用以下指令一键安装所有需要的 Python 依赖

```shell
pip3 install -r {{ config.site_url }}requirements.txt
```

### 可选依赖

一些 Prime Backup 功能所需要的 Python 库并没有在 requirements.txt 中列出,
因为在某些环境下安装这些依赖库可能会 [花不少功夫](https://github.com/oconnor663/blake3-py/issues/41)

如果你想解锁 Prime Backup 的全部功能选项,你可以使用以下命令:
如果你想解锁 Prime Backup 的全部功能特性,你可以使用以下命令:

```bash
pip3 install blake3 lz4
pip3 install -r {{ config.site_url }}requirements.optional.txt
```

这些可选的依赖也被列在了 [requirements.optional.txt](https://github.com/TISUnion/PrimeBackup/blob/master/requirements.optional.txt)
Expand Down
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
mkdocs
mkdocs-macros-plugin
mkdocs-material
mkdocs-mermaid2-plugin
mkdocs-simple-hooks
mkdocs-static-i18n[material]
pymdown-extensions
6 changes: 5 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ theme:
name: Switch to system preference

plugins:
- search
- i18n:
# https://ultrabug.github.io/mkdocs-static-i18n/getting-started/quick-start/#configure-the-plugin-in-your-mkdocsyml
docs_structure: suffix
Expand All @@ -80,9 +79,14 @@ plugins:
site_name: Prime Backup 文档
nav_translations:
Reference: 参考
- macros
# https://mkdocs-mermaid2.readthedocs.io/
- mermaid2:
javascript: js/mermaid-10.8.0.min.js
- mkdocs-simple-hooks:
hooks:
on_post_build: docs.build_hooks:on_post_build
- search

nav:
- index.md
Expand Down

0 comments on commit 77c2165

Please sign in to comment.