docs: 撰写deb文档
Some checks failed
Python application test / build (pull_request) Failing after 12m32s
Some checks failed
Python application test / build (pull_request) Failing after 12m32s
This commit is contained in:
parent
958dee355e
commit
569497f79e
@ -74,9 +74,11 @@ python requirements_detection.py ./requirements.txt -o ./output/report.md
|
||||
|
||||
### 简介
|
||||
|
||||
本项目需要将 Python 代码打包成 pip 包,以便于分发和安装。以下是如何实现和使用该打包功能的详细步骤。
|
||||
本项目需要将 Python 代码打包成`pip`包和`deb`包,以便于分发和安装。以下是如何实现和使用该打包功能的详细步骤。
|
||||
|
||||
### 打包命令
|
||||
### pip
|
||||
|
||||
#### 打包命令
|
||||
|
||||
```bash
|
||||
pip install wheel
|
||||
@ -85,7 +87,7 @@ python setup.py sdist bdist_wheel
|
||||
|
||||
执行上述命令后,会在 dist 目录下生成 .tar.gz 和 .whl 文件。
|
||||
|
||||
### 本地安装
|
||||
#### 本地安装
|
||||
|
||||
- 安装 .whl 文件:
|
||||
|
||||
@ -99,7 +101,7 @@ pip install dist/my_project-0.1.0-py3-none-any.whl
|
||||
pip install dist/my_project-0.1.0.tar.gz
|
||||
```
|
||||
|
||||
## 上传到 PyPI
|
||||
#### 上传到 PyPI
|
||||
|
||||
- 安装 twine:
|
||||
|
||||
@ -115,7 +117,7 @@ twine upload dist/*
|
||||
|
||||
需要提供 PyPI 的用户名和密码。如果没有 PyPI 账号,可以在 PyPI 注册。
|
||||
|
||||
## 使用 PyPI 安装
|
||||
#### 使用 PyPI 安装
|
||||
|
||||
包上传到 PyPI 后,可以通过以下命令安装:
|
||||
|
||||
@ -123,6 +125,40 @@ twine upload dist/*
|
||||
pip install my_project
|
||||
```
|
||||
|
||||
### deb
|
||||
|
||||
#### 命令
|
||||
|
||||
- 安装`stdeb`
|
||||
|
||||
```bash
|
||||
sudo apt-get install python-stdeb
|
||||
```
|
||||
|
||||
- 创建`debian`目录
|
||||
|
||||
- 编写 debian/rules 文件
|
||||
|
||||
```makefile
|
||||
#!/usr/bin/make -f
|
||||
|
||||
%:
|
||||
dh $@
|
||||
```
|
||||
|
||||
- 打包
|
||||
|
||||
```bash
|
||||
python setup.py --command-packages=stdeb.command bdist_deb
|
||||
```
|
||||
|
||||
- 构建DEB包
|
||||
|
||||
```bash
|
||||
cd deb_dist
|
||||
sudo dpkg -i backdoor_buster.deb
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 结论
|
||||
|
@ -48,9 +48,11 @@
|
||||
|
||||
## 8. 打包
|
||||
|
||||
本项目支持打包作为pip包进行发布
|
||||
本项目支持打包作为`pip`包和`deb`包进行发布
|
||||
|
||||
- **主要应用**:通过`wheel`并自行撰写`setup.py`以及`MANIFEST.in`,将项目打包发布
|
||||
- **主要应用**:
|
||||
- `pip`通过`wheel`并自行撰写`setup.py`以及`MANIFEST.in`,将项目打包发布
|
||||
- `deb`通过`stdeb`打包
|
||||
|
||||
## 9. 代码和风险分析
|
||||
|
||||
|
@ -68,7 +68,9 @@ python backdoor_detection.py ./src -o output/report.pdf -m regex
|
||||
|
||||
## 打包
|
||||
|
||||
### 打包命令
|
||||
### pip
|
||||
|
||||
#### 打包命令
|
||||
|
||||
```bash
|
||||
pip install wheel
|
||||
@ -77,7 +79,7 @@ python setup.py sdist bdist_wheel
|
||||
|
||||
执行上述命令后,会在 dist 目录下生成 .tar.gz 和 .whl 文件。
|
||||
|
||||
### 本地安装
|
||||
#### 本地安装
|
||||
|
||||
- 安装 .whl 文件:
|
||||
|
||||
@ -91,7 +93,7 @@ pip install dist/my_project-0.1.0-py3-none-any.whl
|
||||
pip install dist/my_project-0.1.0.tar.gz
|
||||
```
|
||||
|
||||
### 上传到 PyPI
|
||||
#### 上传到 PyPI
|
||||
|
||||
- 安装 twine:
|
||||
|
||||
@ -107,7 +109,7 @@ twine upload dist/*
|
||||
|
||||
需要提供 PyPI 的用户名和密码。如果没有 PyPI 账号,可以在 PyPI 注册。
|
||||
|
||||
### 使用 PyPI 安装
|
||||
#### 使用 PyPI 安装
|
||||
|
||||
包上传到 PyPI 后,可以通过以下命令安装:
|
||||
|
||||
@ -115,6 +117,40 @@ twine upload dist/*
|
||||
pip install my_project
|
||||
```
|
||||
|
||||
### deb
|
||||
|
||||
#### 命令
|
||||
|
||||
- 安装`stdeb`
|
||||
|
||||
```bash
|
||||
sudo apt-get install python-stdeb
|
||||
```
|
||||
|
||||
- 创建`debian`目录
|
||||
|
||||
- 编写 debian/rules 文件
|
||||
|
||||
```makefile
|
||||
#!/usr/bin/make -f
|
||||
|
||||
%:
|
||||
dh $@
|
||||
```
|
||||
|
||||
- 打包
|
||||
|
||||
```bash
|
||||
python setup.py --command-packages=stdeb.command bdist_deb
|
||||
```
|
||||
|
||||
- 构建DEB包
|
||||
|
||||
```bash
|
||||
cd deb_dist
|
||||
sudo dpkg -i backdoor_buster.deb
|
||||
```
|
||||
|
||||
## 常见问题处理
|
||||
|
||||
- 确保所有路径都正确无误,避免因路径错误导致文件读取失败。
|
||||
|
Loading…
x
Reference in New Issue
Block a user