Skip to content

Commit

Permalink
Fix Windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin committed Sep 10, 2024
1 parent 7314dea commit 8c806fd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
Expand All @@ -14,16 +13,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
experimental: [false]
include:
- os: macos-latest
python-version: '3.12'
experimental: false
- os: windows-latest
python-version: '3.12'
experimental: true
experimental: false
# - os: ubuntu-20.04
# python-version: '3.13'
# experimental: true
Expand All @@ -42,6 +35,10 @@ jobs:
run: |
sudo apt-get install -y bison cmake flex g++
- name: Setup Developer Command Prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Install Dependencies
run: pip install -r requirements.txt

Expand Down
3 changes: 3 additions & 0 deletions build_scripts/build_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ def run_cmake(force_clean=False, log_output=False, debug_build=False):
]
if debug_build:
cmd.append("-DCMAKE_BUILD_TYPE=Debug")
else:
if os.name == "nt":
cmd.append("-DCMAKE_BUILD_TYPE=Release")
returncode, stdout = run_cmd(cmd, cwd=OUT_DIR)
# Print the full CMake output to stdout. It is not a lot that it would
# clutter the output, and also gives information about the Python version
Expand Down
3 changes: 3 additions & 0 deletions pytype/imports_map_loader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def __init__(self):
class ImportMapLoaderTest(unittest.TestCase):
"""Tests for imports_map_loader.py."""

maxDiff = None

@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down Expand Up @@ -73,6 +75,7 @@ def test_build_imports_info(self):
("a/b/e", ["2/a/b/foo/#2.py~", "2/a/b/e1.py~", "2/a/b/e2.py~"]),
]
f = file_utils.replace_separator
items = [(f(k), f(v)) for k, v in items]
expected = [(f(k), list(map(f, v))) for k, v in expected]
actual = self.builder._build_multimap(items).items()
self.assertCountEqual(actual, expected)
Expand Down
11 changes: 6 additions & 5 deletions pytype/io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,12 @@ def test_unused_imports_info_files(self):
d.create_file("aaa/other.pyi", "class Other: pass")
imports_info = d.create_file(
"imports_info",
textwrap.dedent(
"""
file_utils.replace_separator(textwrap.dedent("""
common/foo common/foo.pyi
common/bar common/bar.pyi
common/baz common/baz.pyi
aaa/other aaa/other.pyi
""",
),
""")),
)
module = d.create_file("m.py", "from common import foo; print(foo.x)")
unused_imports_info_files = path_utils.join(d.path, "unused_imports_info")
Expand All @@ -173,7 +171,10 @@ def test_unused_imports_info_files(self):
)
with options.open_function(unused_imports_info_files) as f:
content = f.read()
self.assertEqual(content, "aaa/other.pyi\ncommon/baz.pyi\n")
self.assertEqual(
content,
file_utils.replace_separator("aaa/other.pyi\ncommon/baz.pyi\n"),
)


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions pytype/tools/analyze_project/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
PYTYPE_TOML = f"""
[tool.pytype]
exclude = ['nonexistent.*']
pythonpath = \"\"\"
pythonpath = '''
.{os.pathsep}
{'C:' if sys.platform == 'win32' else ''}{os.path.sep}foo{os.path.sep}bar{os.pathsep}
baz{os.path.sep}quux
\"\"\"
'''
python_version = '3.7'
disable = ['import-error', 'module-attr']
"""
Expand Down

0 comments on commit 8c806fd

Please sign in to comment.