Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Pdm
提交
2f8bba9e
P
Pdm
项目概览
后端镜像
/
Pdm
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Pdm
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2f8bba9e
编写于
2月 05, 2020
作者:
F
Frost Ming
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
version from speicified file
上级
eb18d33a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
22 addition
and
7 deletion
+22
-7
pdm/__init__.py
pdm/__init__.py
+1
-1
pdm/builders/base.py
pdm/builders/base.py
+3
-2
pdm/builders/sdist.py
pdm/builders/sdist.py
+5
-2
pdm/project/meta.py
pdm/project/meta.py
+12
-1
pyproject.toml
pyproject.toml
+1
-1
未找到文件。
pdm/__init__.py
浏览文件 @
2f8bba9e
__version__
=
"0.1.
0
"
__version__
=
"0.1.
1-dev
"
pdm/builders/base.py
浏览文件 @
2f8bba9e
...
...
@@ -326,7 +326,7 @@ class Builder:
return
content
def
ensure_setup_py
(
self
)
->
None
:
def
ensure_setup_py
(
self
,
clean
:
bool
=
True
)
->
None
:
"""Ensures the requirement has a setup.py ready."""
# XXX: Currently only handle PDM project, and do nothing if not.
...
...
@@ -348,4 +348,5 @@ class Builder:
def
cleanup
():
os
.
unlink
(
setup_py_path
)
atexit
.
register
(
cleanup
)
if
clean
:
atexit
.
register
(
cleanup
)
pdm/builders/sdist.py
浏览文件 @
2f8bba9e
...
...
@@ -3,6 +3,8 @@ import tarfile
import
tempfile
from
copy
import
copy
from
pkg_resources
import
to_filename
,
safe_version
from
pdm.builders.base
import
Builder
from
pdm.context
import
context
...
...
@@ -50,14 +52,15 @@ class SdistBuilder(Builder):
os
.
makedirs
(
build_dir
,
exist_ok
=
True
)
context
.
io
.
echo
(
"- Building {}..."
.
format
(
context
.
io
.
cyan
(
"sdist"
)))
version
=
to_filename
(
safe_version
(
self
.
meta
.
version
))
target
=
os
.
path
.
join
(
build_dir
,
"{}-{}.tar.gz"
.
format
(
self
.
meta
.
project_name
,
self
.
meta
.
version
)
build_dir
,
"{}-{}.tar.gz"
.
format
(
self
.
meta
.
project_name
,
version
)
)
tar
=
tarfile
.
open
(
target
,
mode
=
"w:gz"
,
format
=
tarfile
.
PAX_FORMAT
)
try
:
tar_dir
=
"{}-{}"
.
format
(
self
.
meta
.
project_name
,
self
.
meta
.
version
)
tar_dir
=
"{}-{}"
.
format
(
self
.
meta
.
project_name
,
version
)
files_to_add
=
self
.
find_files_to_add
(
True
)
...
...
pdm/project/meta.py
浏览文件 @
2f8bba9e
...
...
@@ -43,7 +43,18 @@ class PackageMeta:
self
.
project
=
project
name
=
MetaField
(
"name"
)
version
=
MetaField
(
"version"
)
def
_get_version
(
self
,
value
):
if
isinstance
(
value
,
str
):
return
value
version_source
=
value
.
get
(
"from"
)
with
open
(
version_source
,
encoding
=
"utf-8"
)
as
fp
:
version
=
re
.
findall
(
r
"^__version__\s*=\s*[\"'](.+?)[\"']\s*$"
,
fp
.
read
(),
re
.
M
)[
0
]
return
version
version
=
MetaField
(
"version"
,
_get_version
)
homepage
=
MetaField
(
"homepage"
)
license
=
MetaField
(
"license"
)
...
...
pyproject.toml
浏览文件 @
2f8bba9e
[tool.pdm]
name
=
"pdm"
version
=
"0.1.0"
version
=
{
from
=
"pdm/__init__.py"
}
description
=
"Python Development Master"
author
=
"frostming <mianghong@gmail.com>"
license
=
"MIT"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录