Commit 3e149ff7 authored by Chad Austin's avatar Chad Austin Committed by Facebook GitHub Bot

opt into pyre

Summary:
Now that we have some type annotations, we might as well support
running the type checker.

Reviewed By: xavierd

Differential Revision: D33715757

fbshipit-source-id: baf693e4b2415e0e1aa50b569b744ca0cfb91337
parent 6ba5d05e
......@@ -1225,7 +1225,7 @@ incremental = false
self._patchup_workspace()
try:
from getdeps.facebook.rust import vendored_crates
from .facebook.rust import vendored_crates
vendored_crates(self.build_opts, build_source_dir)
except ImportError:
......
......@@ -17,6 +17,8 @@ import time
import zipfile
from datetime import datetime
from typing import Dict, NamedTuple
from urllib.parse import urlparse
from urllib.request import urlretrieve
from .copytree import prefetch_dir_if_eden
from .envfuncs import Env
......@@ -25,14 +27,6 @@ from .platform import is_windows
from .runcmd import run_cmd
try:
from urllib import urlretrieve
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
from urllib.request import urlretrieve
def file_name_is_cmake_file(file_name):
file_name = file_name.lower()
base = os.path.basename(file_name)
......
......@@ -3,6 +3,7 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import configparser
import io
import os
......@@ -33,11 +34,6 @@ from .fetcher import (
from .py_wheel_builder import PythonWheelBuilder
try:
import configparser
except ImportError:
import ConfigParser as configparser
REQUIRED = "REQUIRED"
OPTIONAL = "OPTIONAL"
......@@ -414,7 +410,7 @@ class ManifestParser(object):
# We need to defer this import until now to avoid triggering
# a cycle when the facebook/__init__.py is loaded.
try:
from getdeps.facebook.lfs import LFSCachingArchiveFetcher
from .facebook.lfs import LFSCachingArchiveFetcher
return LFSCachingArchiveFetcher(
build_options, self, url, self.get("download", "sha256", ctx=ctx)
......
......@@ -9,7 +9,7 @@ import email
import os
import re
import stat
from typing import List
from typing import Dict, List
from .builder import BuilderBase, CMakeBuilder
......@@ -93,11 +93,15 @@ endif()
# something like the following pip3 command:
# pip3 --isolated install --no-cache-dir --no-index --system \
# --target <install_dir> <wheel_file>
# pyre-fixme[13] fields initialized in _build
class PythonWheelBuilder(BuilderBase):
"""This Builder can take Python wheel archives and install them as python libraries
that can be used by add_fb_python_library()/add_fb_python_executable() CMake rules.
"""
dist_info_dir: str
template_format_dict: Dict[str, str]
def _build(self, install_dirs: List[str], reconfigure: bool) -> None:
# When we are invoked, self.src_dir contains the unpacked wheel contents.
#
......@@ -183,7 +187,7 @@ class PythonWheelBuilder(BuilderBase):
)
cmake_builder.build(install_dirs=install_dirs, reconfigure=reconfigure)
def _write_cmakelists(self, path_mapping: List[str], dependencies) -> None:
def _write_cmakelists(self, path_mapping: Dict[str, 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))
......@@ -215,7 +219,9 @@ 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: List[str], src_path: str, install_path: str):
def _add_sources(
self, path_mapping: Dict[str, 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
......
......@@ -19,6 +19,7 @@ import os
from collections import namedtuple
# pyre-fixme[13] This is too magical for Pyre.
class ShellQuoted(namedtuple("ShellQuoted", ("do_not_use_raw_str",))):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment