1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-07 07:02:53 +03:00

use python 3 type annotations

Summary: We don't support Python 2 anymore.

Reviewed By: xavierd

Differential Revision: D33715602

fbshipit-source-id: 6cf3dba83f8207f956cab8eb8dbb3a748e1d9f89
This commit is contained in:
Chad Austin
2022-01-24 20:12:34 -08:00
committed by Facebook GitHub Bot
parent 4fb4756ec9
commit 5c779d26ba
2 changed files with 9 additions and 25 deletions

View File

@@ -98,9 +98,7 @@ class PythonWheelBuilder(BuilderBase):
that can be used by add_fb_python_library()/add_fb_python_executable() CMake rules.
"""
def _build(self, install_dirs, reconfigure):
# type: (List[str], bool) -> None
def _build(self, install_dirs: List[str], reconfigure: bool) -> None:
# When we are invoked, self.src_dir contains the unpacked wheel contents.
#
# Since a wheel file is just a zip file, the Fetcher code recognizes it as such
@@ -169,9 +167,7 @@ class PythonWheelBuilder(BuilderBase):
# Run the build
self._run_cmake_build(install_dirs, reconfigure)
def _run_cmake_build(self, install_dirs, reconfigure):
# type: (List[str], bool) -> None
def _run_cmake_build(self, install_dirs: List[str], reconfigure: bool) -> None:
cmake_builder = CMakeBuilder(
build_opts=self.build_opts,
ctx=self.ctx,
@@ -187,9 +183,7 @@ class PythonWheelBuilder(BuilderBase):
)
cmake_builder.build(install_dirs=install_dirs, reconfigure=reconfigure)
def _write_cmakelists(self, path_mapping, dependencies):
# type: (List[str]) -> None
def _write_cmakelists(self, path_mapping: List[str], dependencies) -> None:
cmake_path = os.path.join(self.build_dir, "CMakeLists.txt")
with open(cmake_path, "w") as f:
f.write(CMAKE_HEADER.format(**self.template_format_dict))
@@ -221,9 +215,7 @@ class PythonWheelBuilder(BuilderBase):
with open(output_path, "w") as f:
f.write(CMAKE_CONFIG_FILE.format(**self.template_format_dict))
def _add_sources(self, path_mapping, src_path, install_path):
# type: (List[str], str, str) -> None
def _add_sources(self, path_mapping: List[str], src_path: str, install_path: str):
s = os.lstat(src_path)
if not stat.S_ISDIR(s.st_mode):
path_mapping[src_path] = install_path
@@ -236,9 +228,7 @@ class PythonWheelBuilder(BuilderBase):
os.path.join(install_path, entry),
)
def _parse_wheel_name(self):
# type: () -> WheelNameInfo
def _parse_wheel_name(self) -> WheelNameInfo:
# The ArchiveFetcher prepends "manifest_name-", so strip that off first.
wheel_name = os.path.basename(self.src_dir)
prefix = self.manifest.name + "-"