Skip to content

Commit

Permalink
v0.0.12-pre
Browse files Browse the repository at this point in the history
  • Loading branch information
zpcc committed Feb 9, 2023
1 parent 4bf6ebc commit 40bf20f
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 47 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/Build.yml
@@ -0,0 +1,58 @@
name: Windows Builds

on:
push:
branches:
- master

permissions:
contents: write

jobs:
build:
runs-on: windows-2022
strategy:
matrix:
include:
- ARCH: "x86"
FILENAME: "mpkg-win32.zip"
- ARCH: "x64"
FILENAME: "mpkg-win64.zip"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.7"
architecture: ${{ matrix.ARCH }}
- name: Install dependencies
run: |
pip install .
pip install pywin32 pyinstaller
pip install setuptools --upgrade
- name: Edit version
if: startsWith(github.ref, 'refs/tags/')
run: |
python scripts\edit_version.py
- name: Build
run: |
copy scripts\bootstrap.py .
pyinstaller bootstrap.py -n mpkg --hidden-import=lxml.etree --hidden-import=bs4 --hidden-import=mpkg.parse
7z a ${{ matrix.FILENAME }} .\dist\mpkg
- name: Upload files to AutoBuild
uses: softprops/action-gh-release@v1
with:
tag_name: AutoBuild
files: |
${{ matrix.FILENAME }}
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.FILENAME }}
path: ${{ matrix.FILENAME }}
- name: Release mpkg
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ matrix.FILENAME }}
8 changes: 6 additions & 2 deletions .github/workflows/Publish.yml
Expand Up @@ -5,14 +5,17 @@ on:
tags:
- "v*"

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
Expand All @@ -24,5 +27,6 @@ jobs:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python scripts/edit_version.py
python setup.py sdist bdist_wheel
python -m twine upload dist/*
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -43,7 +43,7 @@ mpkg download mpkg.download --root .

如果已安装 python3.7(或更高版本),执行 `pip install mpkg` 即可安装。[Releases](https://github.com/mpkg-project/mpkg/releases) 页面提供了用 pyinstaller 打包好的程序,但可能有未知 bug。

如果想尝试最新版本,可通过 `pip install git+https://github.com/mpkg-project/mpkg.git` 安装 git 仓库中的版本,且对应的已打包程序可在 [此处](https://ci.appveyor.com/project/zpcc/mpkg/) 找到。
如果想尝试最新版本,可通过 `pip install --upgrade https://github.com/mpkg-project/mpkg/archive/master.zip` 安装 git 仓库中的版本(可能需要先运行 `pip uninstall mpkg` 卸载旧版本),且对应的已打包程序可在 [此处](https://ci.appveyor.com/project/zpcc/mpkg/) 找到。

## 配置

Expand Down
35 changes: 0 additions & 35 deletions appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion mpkg/__init__.py
@@ -1 +1 @@
__version__ = '0.0.11'
__version__ = '0.0.12-dev'
8 changes: 6 additions & 2 deletions mpkg/commands/cmd_doctor.py
Expand Up @@ -104,7 +104,7 @@ def print_data():
print(f'SYS, MACHINE, ARCH: {SYS}, {MACHINE}, {ARCH}')
print(f'\nbin_dir in PATH: {bin_available}')
if not bin_available:
print(' - try: touch ~/.profile ~/.bashrc && mpkg doctor --fix-bin-env')
print(' - try: mpkg doctor --fix-bin-env')
print(f"\n7z_command: {sevenzip_cmd}")
if sevenzip_cmd.lstrip('"').startswith('7z_not_found'):
print(
Expand All @@ -125,14 +125,18 @@ def print_data():
@click.option('--fix-bin-env', is_flag=True)
@click.option('--fix-7z-path', is_flag=True)
def doctor(repo, fix_bin_env, fix_7z_path, new_winpath, new_test_winpath):
PreInstall()
if not GetConfig('sources'):
PreInstall()
if repo:
add_repo(repo)
elif fix_bin_env:
bin_dir = GetConfig('bin_dir')
if SYS == 'Windows':
add_to_hkcu_path(bin_dir)
elif SYS == 'Linux':
for filepath in [Path.home()/fn for fn in ['.profile', '.bashrc']]:
if not filepath.exists():
filepath.touch()
for filepath in [Path.home()/fn for fn in ['.profile', '.bash_profile', '.bash_login', '.bashrc']]:
if filepath.exists():
add_to_bash_startup(bin_dir, filepath)
Expand Down
2 changes: 1 addition & 1 deletion mpkg/lnktools.py
Expand Up @@ -68,7 +68,7 @@ def __init__(self):

self.END_OF_STRING = '00'

self.cp = locale.getdefaultlocale()[1]
self.cp = locale.getlocale()[1]

def bytes2hex(self, b):
return b.hex()
Expand Down
3 changes: 3 additions & 0 deletions scripts/bootstrap.py
@@ -0,0 +1,3 @@
from mpkg.cli import cli

cli()
7 changes: 7 additions & 0 deletions scripts/edit_version.py
@@ -0,0 +1,7 @@
with open('mpkg/__init__.py', 'r', encoding='utf-8') as f:
text = f.read()

text = text.replace("-dev'", "'")
print(text)
with open('mpkg/__init__.py', 'w', encoding='utf-8') as f:
f.write(text)
8 changes: 3 additions & 5 deletions setup.py
@@ -1,13 +1,10 @@
import os
import re

from setuptools import setup

here = os.path.abspath(os.path.dirname(__file__))
from mpkg import __version__

with open(os.path.join(here, 'mpkg', '__init__.py'), 'rb') as f:
__version__ = re.search(
"__version__.*'([\\d.]+)'", f.read().decode('utf-8')).groups()[0]
here = os.path.abspath(os.path.dirname(__file__))

with open(os.path.join(here, 'README.md'), 'rb') as f:
readme = f.read().decode('utf-8')
Expand Down Expand Up @@ -46,6 +43,7 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
'License :: OSI Approved :: Apache Software License',
],
)

0 comments on commit 40bf20f

Please sign in to comment.