Skip to content

Commit a255cae

Browse files
authored
Update ci (#113)
1 parent 2457f0d commit a255cae

5 files changed

Lines changed: 48 additions & 43 deletions

File tree

.github/workflows/tox.yml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,50 @@ jobs:
1212
access_token: ${{ github.token }}
1313
test:
1414
runs-on: ${{ matrix.platform }}
15+
container: ${{ matrix.container || '' }}
1516
strategy:
1617
matrix:
1718
platform:
18-
- ubuntu-20.04
19-
- macos-12
20-
# - windows-2016
21-
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
19+
- ubuntu-24.04
20+
- windows-2025
21+
python-version: ['3.8', '3.9', '3.10', '3.12']
22+
include:
23+
- platform: ubuntu-24.04
24+
python-version: '3.6'
25+
container: python:3.6-slim
26+
- platform: ubuntu-24.04
27+
python-version: '3.7'
28+
container: python:3.7-slim
29+
- platform: macos-15
30+
python-version: '3.12'
2231

2332
steps:
24-
- uses: actions/checkout@v1
33+
- uses: actions/checkout@v6
2534
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v2
35+
if: ${{ !matrix.container }}
36+
uses: actions/setup-python@v6
2737
with:
2838
python-version: ${{ matrix.python-version }}
29-
- name: Add msbuild to PATH
30-
uses: microsoft/setup-msbuild@v1.0.2
39+
- name: Setup msbuild
40+
if: runner.os == 'Windows'
41+
uses: ilammy/msvc-dev-cmd@v1
3142
continue-on-error: true
43+
- name: Setup cmake
44+
uses: jwlawson/actions-setup-cmake@v1.9
45+
with:
46+
cmake-version: 3.31.0
47+
- name: Install build tools
48+
if: matrix.container
49+
run: |
50+
apt-get update
51+
apt-get install -y make gcc g++ pkg-config
3252
- name: Install dependencies
3353
run: |
3454
python -m pip install --upgrade setuptools pip wheel
3555
python -m pip install tox
56+
- name: Install pkg-config (Windows)
57+
if: runner.os == 'Windows'
58+
run: choco install pkgconfiglite -y
3659
- name: Test with tox
3760
run: tox -e py,lint
3861
env:

appveyor.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

cget/prefix.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import os, shutil, shlex, six, inspect, click, contextlib, sys, functools
1+
import os, shutil, shlex, six, inspect, click, contextlib, sys, functools, hashlib
22

33
from cget.builder import Builder
44
from cget.package import fname_to_pkg
@@ -183,7 +183,10 @@ def get_builder_path(self, *paths):
183183
@contextlib.contextmanager
184184
def create_builder(self, name, tmp=False):
185185
pre = ''
186-
if tmp: pre = 'tmp-'
186+
if tmp:
187+
pre = 'tmp-'
188+
# Use a short hash to avoid exceeding Windows MAX_PATH (260 chars)
189+
name = hashlib.sha256(name.encode()).hexdigest()[:12] if len(name) > 12 else name
187190
d = self.get_builder_path(pre + name)
188191
exists = os.path.exists(d)
189192
util.mkdir(d)

cget/util.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,22 @@ def check_hash(f, hash):
282282
t, h = hash.lower().split(':')
283283
return hash_file(f, t) == h
284284

285+
def is_executable(filepath):
286+
if not os.path.isfile(filepath):
287+
return False
288+
289+
if sys.platform == 'win32':
290+
pathext = os.environ.get('PATHEXT', '').split(';')
291+
return os.path.splitext(filepath)[1].upper() in [e.upper() for e in pathext]
292+
else:
293+
return os.access(filepath, os.X_OK)
294+
285295
def which(p, paths=None, throws=True):
286296
exes = [p+x for x in ['', '.exe', '.bat']]
287297
for dirname in list(paths or [])+os.environ['PATH'].split(os.pathsep):
288298
for exe in exes:
289299
candidate = os.path.join(os.path.expanduser(dirname), exe)
290-
if os.path.isfile(candidate) and os.access(candidate, os.X_OK):
300+
if is_executable(candidate):
291301
return candidate
292302
if throws: raise BuildError("Can't find file %s" % p)
293303
else: return None

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py27,py34,py35,lint
2+
envlist = py,lint
33

44
[testenv]
55
passenv =

0 commit comments

Comments
 (0)