Skip to content

Commit

Permalink
Fix install issue with recent setuptools (#47)
Browse files Browse the repository at this point in the history
The hack to prevent installation on Windows no longer works. I didn't
track down the exact setuptools version where this starts failing, but
just fix the problem by using the `unsupported-python` dependency on
Windows.

Fixes #45 + #46
  • Loading branch information
noahp committed Apr 27, 2023
1 parent 91e1dab commit b5f5470
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exclude: web/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-added-large-files # prevents giant files from being committed.
- id: check-case-conflict # checks for files that would conflict in case-insensitive filesystems.
Expand Down Expand Up @@ -37,19 +37,19 @@ repos:
- id: trailing-whitespace # trims trailing whitespace.

- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.3.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
args: [--profile=black]
files: (dtrx)|(\.(py)$)

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.19.1
rev: 0.22.0
hooks:
- id: check-github-actions
- id: check-github-workflows
Expand All @@ -65,7 +65,7 @@ repos:
files: \./README\.md

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
rev: v3.0.0-alpha.9-for-vscode
hooks:
- id: prettier
args: [--write]
Expand All @@ -82,13 +82,13 @@ repos:
- id: hadolint-docker

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear]

- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.8.0
rev: v0.9.0
hooks:
- id: shellcheck
files: \.sh$
Expand Down
6 changes: 2 additions & 4 deletions dtrx/dtrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def cmp(a, b):
except NameError:
from sets import Set as set

VERSION = "8.5.0"
VERSION = "8.5.1"
VERSION_BANNER = """dtrx version %s
Copyright © 2006-2011 Brett Smith <brettcsmith@brettcsmith.org>
Copyright © 2008 Peter Kelemen <Peter.Kelemen@gmail.com>
Expand All @@ -81,9 +81,7 @@ def cmp(a, b):
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.""" % (
VERSION,
)
Public License for more details.""" % (VERSION,)

# Python3.6 optparse has a hard time parsing this, so ascii transform it
if sys.version_info[:2] == (3, 6):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ project_urls =
[options]
packages = dtrx
install_requires =
platform==unsupported;platform_system=="Windows"
subprocess32;python_version < '3.3'
unsupported-python==1.0.0;platform_system=="Windows"
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*

[options.entry_points]
Expand Down
14 changes: 9 additions & 5 deletions tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,23 @@ def test_nonexistent_file_cmd(ctx):

@invoke.task
def windows(ctx):
"""just check that windows install fails. pulls a minimal wine docker image to test
"""
just check that windows install fails. pulls a minimal wine docker image to test
"""
if docker.in_docker():
print("error: this should not be run in docker!")
sys.exit(1)
ctx.run(
'docker run --rm -v "$(pwd)":/workdir -t tobix/pywine:3.9 bash -c \'wine pip'
" install /workdir' | tee /dev/stderr | grep -q 'ERROR: No matching"
" distribution found for platform==unsupported' || echo \"ERROR: pip install"
' should fail!"',
(
'docker run --rm -v "$(pwd)":/workdir -t tobix/pywine:3.9 bash -c \'wine'
" pip install /workdir' | tee /dev/stderr | grep -q 'UnsupportedPython: One"
" or more packages do not support'"
),
pty=True,
)

print("Hooray 🎉! Windows install failed as expected.")


# Top-level tasks
namespace = invoke.Collection(
Expand Down

0 comments on commit b5f5470

Please sign in to comment.