Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pdf-miner
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Qin Kaijie
pdf-miner
Commits
a7067433
Commit
a7067433
authored
Mar 05, 2024
by
赵小蒙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setup从tag中自动获取版本号
parent
7242a4a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
python-package.yml
.github/workflows/python-package.yml
+9
-1
setup.py
setup.py
+16
-2
No files found.
.github/workflows/python-package.yml
View file @
a7067433
...
...
@@ -20,21 +20,29 @@ jobs:
python-version
:
[
"
3.10"
]
steps
:
-
uses
:
actions/checkout@v4
-
name
:
Checkout code
uses
:
actions/checkout@v4
with
:
fetch-depth
:
0
-
name
:
Set up Python ${{ matrix.python-version }}
uses
:
actions/setup-python@v5
with
:
python-version
:
${{ matrix.python-version }}
-
name
:
Install dependencies
run
:
|
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
-
name
:
Install wheel
run
:
|
python -m pip install wheel
-
name
:
Build wheel
run
:
|
python setup.py bdist_wheel
-
name
:
Upload artifact
uses
:
actions/upload-artifact@v4
with
:
...
...
setup.py
View file @
a7067433
from
setuptools
import
setup
,
find_packages
import
subprocess
def
parse_requirements
(
filename
):
with
open
(
filename
)
as
f
:
lines
=
f
.
read
()
.
splitlines
()
...
...
@@ -15,12 +15,26 @@ def parse_requirements(filename):
return
requires
def
get_version
():
command
=
[
"git"
,
"describe"
,
"--tags"
]
try
:
version
=
subprocess
.
check_output
(
command
)
.
decode
()
.
strip
()
version_parts
=
version
.
split
(
"-"
)
if
len
(
version_parts
)
>
1
and
version_parts
[
0
]
.
startswith
(
"magic_pdf"
):
return
version_parts
[
1
]
else
:
raise
ValueError
(
f
"Invalid version tag {version}. Expected format is magic_pdf-<version>-released."
)
except
Exception
as
e
:
print
(
e
)
return
"0.0.0"
requires
=
parse_requirements
(
'requirements.txt'
)
setup
(
name
=
"magic_pdf"
,
# 项目名
version
=
"0.1.3"
,
# 版本号
# version="0.1.3", # 版本号
version
=
get_version
(),
# 自动从tag中获取版本号
packages
=
find_packages
(),
# 包含所有的包
install_requires
=
requires
,
# 项目依赖的第三方库
python_requires
=
">=3.9"
,
# 项目依赖的 Python 版本
...
...
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