Skip to content

Commit

Permalink
Ensure the setup script is compatible with deprecated Python versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
fbriol committed Oct 9, 2024
1 parent 0016c3f commit 2fb36d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ repos:
hooks:
- id: pyupgrade
args: [--py310-plus]
exclude: setup.py
- repo: https://github.com/PyCQA/flake8
rev: 7.1.0
hooks:
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Working directory
from typing import Any
from typing import Any, List, Optional, Tuple
import os
import pathlib
import platform
Expand All @@ -23,7 +23,7 @@
OSX_DEPLOYMENT_TARGET = '10.14'


def compare_setuptools_version(required: tuple[int, ...]) -> bool:
def compare_setuptools_version(required: Tuple[int, ...]) -> bool:
"""Compare the version of setuptools with the required version."""
current = tuple(map(int, setuptools.__version__.split('.')[:2]))
return current >= required
Expand Down Expand Up @@ -159,7 +159,7 @@ def run(self) -> None:
self.build_cmake(ext)
super().run()

def boost(self) -> list[str] | None:
def boost(self) -> Optional[List[str]]:
"""Return the Boost installation prefix."""
# Do not search system for Boost & disable the search for boost-cmake
boost_option = '-DBoost_NO_SYSTEM_PATHS=TRUE ' \
Expand All @@ -176,7 +176,7 @@ def boost(self) -> list[str] | None:
return None
return f'{boost_option} -DBoost_INCLUDE_DIR={boost_root}'.split()

def eigen(self) -> str | None:
def eigen(self) -> Optional[str]:
"""Return the Eigen3 installation prefix."""
eigen_include_dir = pathlib.Path(sys.prefix, 'include', 'eigen3')
if eigen_include_dir.exists():
Expand Down Expand Up @@ -217,7 +217,7 @@ def is_conda() -> bool:
result = True
return result

def set_cmake_user_options(self) -> list[str]:
def set_cmake_user_options(self) -> List[str]:
"""Set the CMake user options."""
cmake_variable: Any

Expand Down Expand Up @@ -316,7 +316,7 @@ def build_cmake(self, ext) -> None:
# pylint: enable=too-many-instance-attributes


def typehints() -> list[tuple[str, list[str]]]:
def typehints() -> List[Tuple[str, List[str]]]:
"""Get the list of type information files."""
pyi = []
for root, _, files in os.walk(WORKING_DIRECTORY):
Expand Down

0 comments on commit 2fb36d1

Please sign in to comment.