Skip to content

Commit

Permalink
修复打包时版本号代码错误
Browse files Browse the repository at this point in the history
  • Loading branch information
fifilyu committed Dec 9, 2019
1 parent 1706cd3 commit c347795
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@
"""

from os.path import join, dirname

from sppm.version import __version__
from setuptools import setup

with open(join(dirname(__file__), 'sppm/version.py'), 'r', encoding='utf-8') as f:
exec(f.read())
with open(join(dirname(__file__), 'sppm/version.txt'), 'r', encoding='utf-8') as f:
__version__ = f.read().strip()

with open(join(dirname(__file__), 'requirements.txt'), 'r', encoding='utf-8') as f:
pkgs = f.read()
print('pkgs', pkgs)
install_requires = pkgs.split("\n")

setup(
Expand Down
11 changes: 9 additions & 2 deletions sppm/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@
from sppm.settings import hlog, SPPM_CONFIG
from sppm.signal_handler import sigint_handler
from sppm.utils import cleanup
from sppm.version import __version__

exit_status = 0


def get_version():
version_file = Path(__file__).parent / 'version.txt'

with open(str(version_file), 'r', encoding='utf-8') as f:
__version__ = f.read().strip()
return __version__


def parser_cmd_options():
parser = argparse.ArgumentParser(prog=Path(sys.argv[0]),
description='简化进程管理的命令行工具',
Expand Down Expand Up @@ -71,7 +78,7 @@ def parser_cmd_options():
'--version',
help='显示版本信息',
action='version',
version='%(prog)s v' + __version__)
version='%(prog)s v' + get_version())

args = parser.parse_args()

Expand Down
4 changes: 0 additions & 4 deletions sppm/version.py

This file was deleted.

1 change: 1 addition & 0 deletions sppm/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.1.4

0 comments on commit c347795

Please sign in to comment.