build(pyinstaller): add linux binary support

This commit is contained in:
Rémi Alvergnat
2021-02-04 00:13:10 +01:00
parent 94caaa797f
commit d0df79f477
5 changed files with 82 additions and 21 deletions
+37 -17
View File
@@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ 3.5, 3.6, 3.7, 3.8, 3.9, pypy-3.6, pypy-3.7 ]
python-version: [ 3.5, 3.6, 3.7, 3.8, 3.9 ] # pypy-3.6, pypy-3.7 are supported but a bit slow.
regex: [ "0", "1" ]
exclude:
# regex module doesn't play well with pypy and unicode.
@@ -18,6 +18,15 @@ jobs:
regex: "1"
- python-version: pypy-3.7
regex: "1"
# test regex module only with Python 3.8.
- python-version: 3.5
regex: "1"
- python-version: 3.6
regex: "1"
- python-version: 3.7
regex: "1"
- python-version: 3.9
regex: "1"
steps:
- name: Setup python ${{ matrix.python-version }}
@@ -41,25 +50,44 @@ jobs:
- name: Install regex
run: |
pip install regex
if: ${{ matrix.regex == '1' }}
if: matrix.regex == '1'
- run: pylint guessit
- name: Pylint
run: pylint guessit
if: matrix.python-version != '3.9'
- run: coverage run --source=guessit setup.py test
- name: Test
run: coverage run --source=guessit setup.py test
env:
REBULK_REGEX_ENABLED: ${{ matrix.regex }}
- run: python setup.py build
- name: Coveralls
run: coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
- name: Build
run: python setup.py build
- name: Binary
run: pyinstaller --dist ./dist guessit.spec
if: matrix.python-version != 'pypy-3.7'
- name: Check binary
run: ./dist/guessit "Treme.1x03.Right.Place,.Wrong.Time.HDTV.XviD-NoTV.avi"
if: matrix.python-version != 'pypy-3.7'
- uses: actions/upload-artifact@v2
if: matrix.regex == '0'
with:
name: guessit-dist-${{matrix.python-version}}
path: ./dist
commitlint:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
@@ -67,21 +95,16 @@ jobs:
- uses: wagoid/commitlint-github-action@v2
release:
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ 3.8 ]
steps:
- name: Setup python ${{ matrix.python-version }}
- name: Setup python 3.8
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
python-version: 3.8
- name: Checkout
uses: actions/checkout@v2
@@ -93,9 +116,6 @@ jobs:
git config --global user.email "action@github.com"
git config --global user.name "github-actions"
- name: Install Dependencies
run: pip install -e .[test]
- name: Install python-semantic-release
run: pip install python-semantic-release
+42
View File
@@ -0,0 +1,42 @@
# -*- mode: python -*-
block_cipher = None
import babelfish
a = Analysis(['guessit/__main__.py'],
pathex=[],
binaries=[],
datas=[
('guessit/config/*', 'guessit/config'),
('guessit/data/*', 'guessit/data'),
(babelfish.__path__[0] + '/data', 'babelfish/data')
],
hiddenimports=[
'pkg_resources.py2_warn', # https://github.com/pypa/setuptools/issues/1963
'babelfish.converters.alpha2',
'babelfish.converters.alpha3b',
'babelfish.converters.alpha3t',
'babelfish.converters.name',
'babelfish.converters.opensubtitles',
'babelfish.converters.countryname'
],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=True,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='guessit',
debug=False,
strip=False,
upx=False,
runtime_tmpdir=None,
console=True )
+1 -1
View File
@@ -27,7 +27,7 @@ def website(config):
rebulk = rebulk.regex_defaults(flags=re.IGNORECASE).string_defaults(ignore_case=True)
rebulk.defaults(name="website")
with resource_stream('guessit', 'tlds-alpha-by-domain.txt') as tld_file:
with resource_stream('guessit', 'data/tlds-alpha-by-domain.txt') as tld_file:
tlds = [
tld.strip().decode('utf-8')
for tld in tld_file.readlines()
+2 -3
View File
@@ -6,7 +6,6 @@ from setuptools import setup, find_packages
import io
import os
import re
import sys
here = os.path.abspath(os.path.dirname(__file__))
@@ -20,11 +19,11 @@ install_requires = ['rebulk>=3', 'babelfish', 'python-dateutil']
setup_requires = ['pytest-runner']
dev_require = ['tox', 'mkdocs', 'mkdocs-material']
dev_require = ['tox', 'mkdocs', 'mkdocs-material', 'pyinstaller']
tests_require = ['pytest', 'pytest-benchmark', 'pylint', 'PyYAML']
package_data = ['config/*']
package_data = ['config/*', 'data/*']
entry_points = {
'console_scripts': [