diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7afac5bb..2ec9b419 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,6 +57,14 @@ jobs: env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + - run: pyinstaller --clean -y --dist ./dist guessit.spec + + - 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 diff --git a/guessit.spec b/guessit.spec new file mode 100644 index 00000000..dfab59ff --- /dev/null +++ b/guessit.spec @@ -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 ) \ No newline at end of file diff --git a/guessit/tlds-alpha-by-domain.txt b/guessit/data/tlds-alpha-by-domain.txt similarity index 100% rename from guessit/tlds-alpha-by-domain.txt rename to guessit/data/tlds-alpha-by-domain.txt diff --git a/guessit/rules/properties/website.py b/guessit/rules/properties/website.py index c1965311..96bed640 100644 --- a/guessit/rules/properties/website.py +++ b/guessit/rules/properties/website.py @@ -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() diff --git a/setup.py b/setup.py index 3c5edea1..966de522 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ setup_requires = ['pytest-runner'] -dev_require = ['tox', 'mkdocs', 'mkdocs-material'] +dev_require = ['tox', 'mkdocs', 'mkdocs-material', 'pyinstaller'] tests_require = ['pytest', 'pytest-benchmark', 'pylint', 'PyYAML']