Skip to content

Improve distutils #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Aug 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions stdlib/2.7/distutils/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
# Stubs for distutils (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any

__revision__ = ... # type: Any
5 changes: 5 additions & 0 deletions stdlib/2.7/distutils/emxccompiler.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Stubs for emxccompiler

from distutils.unixccompiler import UnixCCompiler

class EMXCCompiler(UnixCCompiler): ...
23 changes: 0 additions & 23 deletions stdlib/2.7/distutils/version.pyi

This file was deleted.

File renamed without changes.
12 changes: 12 additions & 0 deletions stdlib/2and3/distutils/archive_util.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Stubs for distutils.archive_util

from typing import Optional


def make_archive(base_name: str, format: str, root_dir: Optional[str] = ...,
base_dir: Optional[str] = ..., verbose: int = ...,
dry_run: int = ...) -> str: ...
def make_tarball(base_name: str, base_dir: str, compress: Optional[str] = ...,
verbose: int = ..., dry_run: int = ...) -> str: ...
def make_zipfile(base_name: str, base_dir: str, verbose: int = ...,
dry_run: int = ...) -> str: ...
6 changes: 6 additions & 0 deletions stdlib/2and3/distutils/bcppcompiler.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Stubs for distutils.bcppcompiler

from distutils.ccompiler import CCompiler


class BCPPCompiler(CCompiler): ...
119 changes: 119 additions & 0 deletions stdlib/2and3/distutils/ccompiler.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Stubs for distutils.ccompiler

from typing import Any, Callable, List, Optional, Tuple, Union


_Macro = Union[Tuple[str], Tuple[str, str]]


def gen_lib_options(compiler: CCompiler, library_dirs: List[str],
runtime_library_dirs: List[str],
libraries: List[str]) -> List[str]: ...
def gen_preprocess_options(macros: List[_Macro],
include_dirs: List[str]) -> List[str]: ...
def get_default_compiler(osname: Optional[str] = ...,
platform: Optional[str] = ...) -> str: ...
def new_compiler(plat: Optional[str] = ..., compiler: Optional[str] = ...,
verbose: int = ..., dry_run: int = ...,
force: int = ...) -> CCompiler: ...
def show_compilers() -> None: ...

class CCompiler:
def __init__(self, verbose: int = ..., dry_run: int = ...,
force: int = ...) -> None: ...
def add_include_dir(self, dir: str) -> None: ...
def set_include_dirs(self, dirs: List[str]) -> None: ...
def add_library(self, libname: str) -> None: ...
def set_libraries(self, libnames: List[str]) -> None: ...
def add_library_dir(self, dir: str) -> None: ...
def set_library_dirs(self, dirs: List[str]) -> None: ...
def add_runtime_library_dir(self, dir: str) -> None: ...
def set_runtime_library_dirs(self, dirs: List[str]) -> None: ...
def define_macro(self, name: str, value: Optional[str] = ...) -> None: ...
def undefine_macro(self, name: str) -> None: ...
def add_link_object(self, object: str) -> None: ...
def set_link_objects(self, objects: List[str]) -> None: ...
def detect_language(self, sources: Union[str, List[str]]) -> Optional[str]: ...
def find_library_file(self, dirs: List[str], lib: str,
debug: bool = ...) -> Optional[str]: ...
def has_function(self, funcname: str, includes: Optional[List[str]] = ...,
include_dirs: Optional[List[str]] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...) -> bool: ...
def library_dir_option(self, dir: str) -> str: ...
def library_option(self, lib: str) -> str: ...
def runtime_library_dir_option(self, dir: str) -> str: ...
def set_executables(self, **args: str) -> None: ...
def compile(self, sources: List[str], output_dir: Optional[str] = ...,
macros: Optional[_Macro] = ...,
include_dirs: Optional[List[str]] = ..., debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
depends: Optional[List[str]] = ...) -> List[str]: ...
def create_static_lib(self, objects: List[str], output_libname: str,
output_dir: Optional[str] = ..., debug: bool = ...,
target_lang: Optional[str] = ...) -> None: ...
def link(self, target_desc: str, objects: List[str], output_filename: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ..., debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...) -> None: ...
def link_executable(self, objects: List[str], output_progname: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
target_lang: Optional[str] = ...) -> None: ...
def link_shared_lib(self, objects: List[str], output_libname: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...) -> None: ...
def link_shared_object(self, objects: List[str], output_filename: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...) -> None: ...
def preprocess(self, source: str, output_file: Optional[str] = ...,
macros: Optional[List[_Macro]] = ...,
include_dirs: Optional[List[str]] = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...) -> None: ...
def executable_filename(self, basename: str, strip_dir: int = ...,
output_dir: str = ...) -> str: ...
def library_filename(self, libname: str, lib_type: str = ...,
strip_dir: int = ...,
output_dir: str = ...) -> str: ...
def object_filenames(self, source_filenames: List[str],
strip_dir: int = ...,
output_dir: str = ...) -> List[str]: ...
def shared_object_filename(self, basename: str, strip_dir: int = ...,
output_dir: str = ...) -> str: ...
def execute(self, func: Callable[..., None], args: Tuple[Any, ...],
msg: Optional[str] = ..., level: int = ...) -> None: ...
def spawn(self, cmd: List[str]) -> None: ...
def mkpath(self, name: str, mode: int = ...) -> None: ...
def move_file(self, src: str, dst: str) -> str: ...
def announce(self, msg: str, level: int = ...) -> None: ...
def warn(self, msg: str) -> None: ...
def debug_print(self, msg: str) -> None: ...
15 changes: 15 additions & 0 deletions stdlib/2and3/distutils/cmd.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Stubs for distutils.cmd

from typing import Callable, List, Tuple, Union
from abc import abstractmethod
from distutils.dist import Distribution

class Command:
sub_commands = ... # type: List[Tuple[str, Union[Callable[[], bool], str, None]]]
def __init__(self, dist: Distribution) -> None: ...
@abstractmethod
def initialize_options(self) -> None: ...
@abstractmethod
def finalize_options(self) -> None: ...
@abstractmethod
def run(self) -> None: ...
Empty file.
Empty file.
Empty file.
5 changes: 5 additions & 0 deletions stdlib/2and3/distutils/command/bdist_msi.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Stubs for distutils.command.bdist_msi

from distutils.cmd import Command

class bdist_msi(Command): ...
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
8 changes: 8 additions & 0 deletions stdlib/2and3/distutils/command/build_py.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Stubs for distutils.command.bdist_msi

from distutils.cmd import Command
import sys

if sys.version_info >= (3,):
class build_py(Command): ...
class build_py_2to3(Command): ...
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
35 changes: 35 additions & 0 deletions stdlib/2and3/distutils/core.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Stubs for distutils.core

from typing import Any, List, Mapping, Optional, Tuple, Type, Union
from distutils.cmd import Command as Command
from distutils.dist import Distribution as Distribution
from distutils.extension import Extension as Extension

def setup(name: str = ...,
version: str = ...,
description: str = ...,
long_description: str = ...,
author: str = ...,
author_email: str = ...,
maintainer: str = ...,
maintainer_email: str = ...,
url: str = ...,
download_url: str = ...,
packages: List[str] = ...,
py_modules: List[str] = ...,
scripts: List[str] = ...,
ext_modules: List[Extension] = ...,
classifiers: List[str] = ...,
distclass: Type[Distribution] = ...,
script_name: str = ...,
script_args: List[str] = ...,
options: Mapping[str, Any] = ...,
license: str = ...,
keywords: Union[List[str], str] = ...,
platforms: Union[List[str], str] = ...,
cmdclass: Mapping[str, Command] = ...,
data_files: List[Tuple[str, List[str]]] = ...,
package_dir: Mapping[str, str] = ...) -> None: ...
def run_setup(script_name: str,
script_args: Optional[List[str]] = ...,
stop_after: str = ...) -> Distribution: ...
7 changes: 7 additions & 0 deletions stdlib/2and3/distutils/cygwinccompiler.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Stubs for distutils.cygwinccompiler

from distutils.unixccompiler import UnixCCompiler


class CygwinCCompiler(UnixCCompiler): ...
class Mingw32CCompiler(CygwinCCompiler): ...
3 changes: 3 additions & 0 deletions stdlib/2and3/distutils/debug.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Stubs for distutils.debug

DEBUG = ... # type: bool
8 changes: 8 additions & 0 deletions stdlib/2and3/distutils/dep_util.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Stubs for distutils.dep_util

from typing import List, Tuple

def newer(source: str, target: str) -> bool: ...
def newer_pairwise(sources: List[str],
targets: List[str]) -> List[Tuple[str, str]]: ...
def newer_group(sources: List[str], target: str, missing: str = ...) -> bool: ...
15 changes: 15 additions & 0 deletions stdlib/2and3/distutils/dir_util.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Stubs for distutils.dir_util

from typing import List


def mkpath(name: str, mode: int = ..., verbose: int = ...,
dry_run: int = ...) -> List[str]: ...
def create_tree(base_dir: str, files: List[str], mode: int = ...,
verbose: int = ..., dry_run: int = ...) -> None: ...
def copy_tree(src: str, dst: str, preserve_mode: int = ...,
preserve_times: int = ..., preserve_symlinks: int = ...,
update: int = ..., verbose: int = ...,
dry_run: int = ...) -> List[str]: ...
def remove_tree(directory: str, verbose: int = ...,
dry_run: int = ...) -> None: ...
7 changes: 7 additions & 0 deletions stdlib/2and3/distutils/dist.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Stubs for distutils.dist

from typing import Any, Mapping, Optional


class Distribution:
def __init__(self, attrs: Optional[Mapping[str, Any]] = ...) -> None: ...
4 changes: 4 additions & 0 deletions stdlib/2and3/distutils/errors.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Stubs for distutils.errors

class DistutilsExecError(Exception): ...
class DistutilsFileError(Exception): ...
39 changes: 39 additions & 0 deletions stdlib/2and3/distutils/extension.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Stubs for distutils.extension

from typing import List, Optional, Tuple
import sys

class Extension:
if sys.version_info >= (3,):
def __init__(self,
*, name: str = ...,
sources: List[str] = ...,
include_dirs: List[str] = ...,
define_macros: List[Tuple[str, Optional[str]]] = ...,
undef_macros: List[str] = ...,
library_dirs: List[str] = ...,
libraries: List[str] = ...,
runtime_library_dirs: List[str] = ...,
extra_objects: List[str] = ...,
extra_compile_args: List[str] = ...,
extra_link_args: List[str] = ...,
export_symbols: List[str] = ...,
depends: List[str] = ...,
language: str = ...,
optional: bool = ...) -> None: ...
else:
def __init__(self,
*, name: str = ...,
sources: List[str] = ...,
include_dirs: List[str] = ...,
define_macros: List[Tuple[str, Optional[str]]] = ...,
undef_macros: List[str] = ...,
library_dirs: List[str] = ...,
libraries: List[str] = ...,
runtime_library_dirs: List[str] = ...,
extra_objects: List[str] = ...,
extra_compile_args: List[str] = ...,
extra_link_args: List[str] = ...,
export_symbols: List[str] = ...,
depends: List[str] = ...,
language: str = ...) -> None: ...
27 changes: 27 additions & 0 deletions stdlib/2and3/distutils/fancy_getopt.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Stubs for distutils.fancy_getopt

from typing import (
Any, List, Mapping, Optional, Tuple, Union,
TypeVar, overload,
)

_Option = Tuple[str, str, str]
_GR = Tuple[List[str], OptionDummy]

def fancy_getopt(options: List[_Option],
negative_opt: Mapping[_Option, _Option],
object: Any,
args: Optional[List[str]]) -> Union[List[str], _GR]: ...
def wrap_text(text: str, width: int) -> List[str]: ...

class FancyGetopt:
def __init__(self, option_table: Optional[List[_Option]] = ...) -> None: ...
# TODO kinda wrong, `getopt(object=object())` is invalid
@overload
def getopt(self, args: Optional[List[str]] = ...) -> _GR: ...
@overload
def getopt(self, args: Optional[List[str]], object: Any) -> List[str]: ...
def get_option_order(self) -> List[Tuple[str, str]]: ...
def generate_help(self, header: Optional[str] = ...) -> List[str]: ...

class OptionDummy: ...
12 changes: 12 additions & 0 deletions stdlib/2and3/distutils/file_util.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Stubs for distutils.file_util

from typing import Optional, Sequence, Tuple


def copy_file(src: str, dst: str, preserve_mode: bool = ...,
preserve_times: bool = ..., update: bool = ...,
link: Optional[str] = ..., verbose: bool = ...,
dry_run: bool = ...) -> Tuple[str, str]: ...
def move_file(src: str, dst: str, verbose: bool = ...,
dry_run: bool = ...) -> str: ...
def write_file(filename: str, contents: Sequence[str]) -> None: ...
3 changes: 3 additions & 0 deletions stdlib/2and3/distutils/filelist.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Stubs for distutils.filelist

class FileList: ...
Empty file added stdlib/2and3/distutils/log.pyi
Empty file.
6 changes: 6 additions & 0 deletions stdlib/2and3/distutils/msvccompiler.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Stubs for distutils.msvccompiler

from distutils.ccompiler import CCompiler


class MSVCCompiler(CCompiler): ...
8 changes: 8 additions & 0 deletions stdlib/2and3/distutils/spawn.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Stubs for distutils.spawn

from typing import Optional

def spawn(cmd: List[str], search_path: bool = ...,
verbose: bool = ..., dry_run: bool = ...) -> None: ...
def find_executable(executable: str,
path: Optional[str] = ...) -> Optional[str]: ...
Loading