Skip to content

Commit

Permalink
update winmake.py
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Oct 20, 2024
1 parent fb68f9f commit 8e89a05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 38 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ test-coverage: ## Run test coverage.
ruff: ## Run ruff linter.
@git ls-files '*.py' | xargs $(PYTHON) -m ruff check --output-format=concise

black: ## Python files linting (via black)
black: ## Run black formatter.
@git ls-files '*.py' | xargs $(PYTHON) -m black --check --safe

_pylint: ## Python pylint (not mandatory, just run it from time to time)
Expand All @@ -180,10 +180,10 @@ _pylint: ## Python pylint (not mandatory, just run it from time to time)
lint-c: ## Run C linter.
@git ls-files '*.c' '*.h' | xargs $(PYTHON) scripts/internal/clinter.py

lint-rst: ## Run C linter.
lint-rst: ## Run linter for .rst files.
@git ls-files '*.rst' | xargs rstcheck --config=pyproject.toml

lint-toml: ## Linter for pyproject.toml
lint-toml: ## Run linter for pyproject.toml.
@git ls-files '*.toml' | xargs toml-sort --check

lint-all: ## Run all linters
Expand Down
39 changes: 4 additions & 35 deletions scripts/internal/winmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,19 @@
import os
import shutil
import site
import ssl
import subprocess
import sys
import tempfile


APPVEYOR = bool(os.environ.get('APPVEYOR'))
PYTHON = sys.executable if APPVEYOR else os.getenv('PYTHON', sys.executable)
PY3 = sys.version_info[0] >= 3
PYTEST_ARGS = "-v -s --tb=short"
if PY3:
PYTEST_ARGS += "-o "
HERE = os.path.abspath(os.path.dirname(__file__))
ROOT_DIR = os.path.realpath(os.path.join(HERE, "..", ".."))
PYPY = '__pypy__' in sys.builtin_module_names
WINDOWS = os.name == "nt"
if PY3:
GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
else:
GET_PIP_URL = "https://bootstrap.pypa.io/pip/2.7/get-pip.py"


sys.path.insert(0, ROOT_DIR) # so that we can import setup.py

Expand Down Expand Up @@ -259,31 +252,7 @@ def upload_wheels():

def install_pip():
"""Install pip."""
try:
sh('%s -c "import pip"' % PYTHON)
except SystemExit:
if PY3:
from urllib.request import urlopen
else:
from urllib2 import urlopen

if hasattr(ssl, '_create_unverified_context'):
ctx = ssl._create_unverified_context()
else:
ctx = None
kw = dict(context=ctx) if ctx else {}
safe_print("downloading %s" % GET_PIP_URL)
req = urlopen(GET_PIP_URL, **kw)
data = req.read()

tfile = os.path.join(tempfile.gettempdir(), 'get-pip.py')
with open(tfile, 'wb') as f:
f.write(data)

try:
sh('%s %s --user' % (PYTHON, tfile))
finally:
os.remove(tfile)
sh('%s %s' % (PYTHON, os.path.join(HERE, "install_pip.py")))


def install():
Expand Down Expand Up @@ -368,14 +337,14 @@ def install_pydeps_test():
"""Install useful deps."""
install_pip()
install_git_hooks()
sh("%s -m pip install -U %s" % (PYTHON, " ".join(TEST_DEPS)))
sh("%s -m pip install --user -U %s" % (PYTHON, " ".join(TEST_DEPS)))


def install_pydeps_dev():
"""Install useful deps."""
install_pip()
install_git_hooks()
sh("%s -m pip install -U %s" % (PYTHON, " ".join(DEV_DEPS)))
sh("%s -m pip install --user -U %s" % (PYTHON, " ".join(DEV_DEPS)))


def test(args=""):
Expand Down

0 comments on commit 8e89a05

Please sign in to comment.