Browse Source

Restoring authorship annotation for <say@yandex-team.ru>. Commit 2 of 2.

say 3 years ago
parent
commit
2096e85a73

+ 54 - 54
build/plugins/pybuild.py

@@ -1,15 +1,15 @@
 import os
 import collections
-from hashlib import md5 
+from hashlib import md5
 
 import ymake
 from _common import stripext, rootrel_arc_src, tobuilddir, listid, resolve_to_ymake_path, generate_chunks, pathid
 
 
-YA_IDE_VENV_VAR = 'YA_IDE_VENV' 
-PY_NAMESPACE_PREFIX = 'py/namespace' 
+YA_IDE_VENV_VAR = 'YA_IDE_VENV'
+PY_NAMESPACE_PREFIX = 'py/namespace'
 BUILTIN_PROTO = 'builtin_proto'
- 
+
 def is_arc_src(src, unit):
     return (
         src.startswith('${ARCADIA_ROOT}/') or
@@ -17,13 +17,13 @@ def is_arc_src(src, unit):
         unit.resolve_arc_path(src).startswith('$S/')
     )
 
-def is_extended_source_search_enabled(path, unit): 
-    if not is_arc_src(path, unit): 
-        return False 
-    if unit.get('NO_EXTENDED_SOURCE_SEARCH') == 'yes': 
-        return False 
-    return True 
- 
+def is_extended_source_search_enabled(path, unit):
+    if not is_arc_src(path, unit):
+        return False
+    if unit.get('NO_EXTENDED_SOURCE_SEARCH') == 'yes':
+        return False
+    return True
+
 def to_build_root(path, unit):
     if is_arc_src(path, unit):
         return '${ARCADIA_BUILD_ROOT}/' + rootrel_arc_src(path, unit)
@@ -147,10 +147,10 @@ def is_py3(unit):
     return unit.get("PYTHON3") == "yes"
 
 
-def on_py_program(unit, *args): 
-    py_program(unit, is_py3(unit)) 
- 
- 
+def on_py_program(unit, *args):
+    py_program(unit, is_py3(unit))
+
+
 def py_program(unit, py3):
     """
     Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/#modulpyprogramimakrospymain
@@ -194,11 +194,11 @@ def onpy_srcs(unit, *args):
 
     upath = unit.path()[3:]
     py3 = is_py3(unit)
-    py_main_only = unit.get('PROCESS_PY_MAIN_ONLY') 
+    py_main_only = unit.get('PROCESS_PY_MAIN_ONLY')
     with_py = not unit.get('PYBUILD_NO_PY')
     with_pyc = not unit.get('PYBUILD_NO_PYC')
     in_proto_library = unit.get('PY_PROTO') or unit.get('PY3_PROTO')
-    venv = unit.get(YA_IDE_VENV_VAR) 
+    venv = unit.get(YA_IDE_VENV_VAR)
     need_gazetteer_peerdir = False
     trim = 0
 
@@ -235,7 +235,7 @@ def onpy_srcs(unit, *args):
     protos = []
     evs = []
     fbss = []
-    py_namespaces = {} 
+    py_namespaces = {}
 
     dump_dir = unit.get('PYTHON_BUILD_DUMP_DIR')
     dump_output = None
@@ -304,25 +304,25 @@ def onpy_srcs(unit, *args):
                     if arg.startswith('/'):
                         ymake.report_configure_error('PY_SRCS item starts with "/": {!r}'.format(arg))
                         continue
-                    mod_name = stripext(arg).replace('/', '.') 
-                    if py3 and path.endswith('.py') and is_extended_source_search_enabled(path, unit): 
-                        # Dig out real path from the file path. Unit.path is not enough because of SRCDIR and ADDINCL 
-                        root_rel_path = rootrel_arc_src(path, unit) 
-                        mod_root_path = root_rel_path[:-(len(path) + 1)] 
-                        py_namespaces.setdefault(mod_root_path, set()).add(ns if ns else '.') 
-                    mod = ns + mod_name 
+                    mod_name = stripext(arg).replace('/', '.')
+                    if py3 and path.endswith('.py') and is_extended_source_search_enabled(path, unit):
+                        # Dig out real path from the file path. Unit.path is not enough because of SRCDIR and ADDINCL
+                        root_rel_path = rootrel_arc_src(path, unit)
+                        mod_root_path = root_rel_path[:-(len(path) + 1)]
+                        py_namespaces.setdefault(mod_root_path, set()).add(ns if ns else '.')
+                    mod = ns + mod_name
 
             if main_mod:
                 py_main(unit, mod + ":main")
             elif py3 and unit_needs_main and main_py:
                 py_main(unit, mod)
 
-            if py_main_only: 
-                continue 
- 
-            if py3 and mod == '__main__': 
-                ymake.report_configure_error('TOP_LEVEL __main__.py is not allowed in PY3_PROGRAM') 
- 
+            if py_main_only:
+                continue
+
+            if py3 and mod == '__main__':
+                ymake.report_configure_error('TOP_LEVEL __main__.py is not allowed in PY3_PROGRAM')
+
             pathmod = (path, mod)
 
             if dump_output is not None:
@@ -441,28 +441,28 @@ def onpy_srcs(unit, *args):
         res = []
 
         if py3:
-            mod_list_md5 = md5() 
+            mod_list_md5 = md5()
             for path, mod in pys:
-                mod_list_md5.update(mod) 
-                if not (venv and is_extended_source_search_enabled(path, unit)): 
-                    dest = 'py/' + mod.replace('.', '/') + '.py' 
-                    if with_py: 
-                        res += ['DEST', dest, path] 
-                    if with_pyc: 
-                        root_rel_path = rootrel_arc_src(path, unit) 
-                        dst = path + uniq_suffix(path, unit) 
-                        unit.on_py3_compile_bytecode([root_rel_path + '-', path, dst]) 
-                        res += ['DEST', dest + '.yapyc3', dst + '.yapyc3'] 
-
-            if py_namespaces: 
-                # Note: Add md5 to key to prevent key collision if two or more PY_SRCS() used in the same ya.make 
-                ns_res = [] 
-                for path, ns in sorted(py_namespaces.items()): 
-                    key = '{}/{}/{}'.format(PY_NAMESPACE_PREFIX, mod_list_md5.hexdigest(), path) 
-                    namespaces = ':'.join(sorted(ns)) 
-                    ns_res += ['-', '{}="{}"'.format(key, namespaces)] 
-                unit.onresource(ns_res) 
- 
+                mod_list_md5.update(mod)
+                if not (venv and is_extended_source_search_enabled(path, unit)):
+                    dest = 'py/' + mod.replace('.', '/') + '.py'
+                    if with_py:
+                        res += ['DEST', dest, path]
+                    if with_pyc:
+                        root_rel_path = rootrel_arc_src(path, unit)
+                        dst = path + uniq_suffix(path, unit)
+                        unit.on_py3_compile_bytecode([root_rel_path + '-', path, dst])
+                        res += ['DEST', dest + '.yapyc3', dst + '.yapyc3']
+
+            if py_namespaces:
+                # Note: Add md5 to key to prevent key collision if two or more PY_SRCS() used in the same ya.make
+                ns_res = []
+                for path, ns in sorted(py_namespaces.items()):
+                    key = '{}/{}/{}'.format(PY_NAMESPACE_PREFIX, mod_list_md5.hexdigest(), path)
+                    namespaces = ':'.join(sorted(ns))
+                    ns_res += ['-', '{}="{}"'.format(key, namespaces)]
+                unit.onresource(ns_res)
+
             unit.onresource_files(res)
             add_python_lint_checks(unit, 3, [path for path, mod in pys] + unit.get(['_PY_EXTRA_LINT_FILES_VALUE']).split())
         else:
@@ -583,8 +583,8 @@ def onpy_register(unit, *args):
 
 
 def py_main(unit, arg):
-    if unit.get('IGNORE_PY_MAIN'): 
-        return 
+    if unit.get('IGNORE_PY_MAIN'):
+        return
     unit_needs_main = unit.get('MODULE_TYPE') in ('PROGRAM', 'DLL')
     if unit_needs_main:
         py_program(unit, is_py3(unit))

+ 3 - 3
build/prebuilt/contrib/tools/ragel6/ya.make.resource

@@ -1,9 +1,9 @@
 IF (OS_DARWIN AND ARCH_X86_64)
-    SET(SANDBOX_RESOURCE_ID 1959624378) 
+    SET(SANDBOX_RESOURCE_ID 1959624378)
 ELSEIF (OS_LINUX AND ARCH_X86_64)
-    SET(SANDBOX_RESOURCE_ID 1969915297) 
+    SET(SANDBOX_RESOURCE_ID 1969915297)
 ELSEIF (OS_WINDOWS AND ARCH_X86_64)
-    SET(SANDBOX_RESOURCE_ID 1959624268) 
+    SET(SANDBOX_RESOURCE_ID 1959624268)
 ELSE()
     SET(SANDBOX_RESOURCE_ID)
 ENDIF()

+ 82 - 82
build/ymake.core.conf

@@ -59,7 +59,7 @@ LIB_REQUIREMENTS=$DEFAULT_REQUIREMENTS
 LD_REQUIREMENTS=$DEFAULT_REQUIREMENTS
 JAVA_REQUIREMENTS=$DEFAULT_REQUIREMENTS
 PY_REQUIREMENTS=$DEFAULT_REQUIREMENTS
-BISON_DATA_DIR=contrib/tools/bison/bison/data 
+BISON_DATA_DIR=contrib/tools/bison/bison/data
 CPP_BISON_SKELS=${BISON_DATA_DIR}/glr.cc ${BISON_DATA_DIR}/lalr1.cc ${BISON_DATA_DIR}/yacc.c ${BISON_DATA_DIR}/stack.hh ${BISON_DATA_DIR}/variant.hh ${BISON_DATA_DIR}/c++.m4 ${BISON_DATA_DIR}/c++-skel.m4
 
 USE_PREBUILT_TOOLS=yes
@@ -1710,18 +1710,18 @@ module PY2_PROGRAM: _PY2_PROGRAM {
 }
 
 # tag:python-specific
-### @usage: NO_EXTENDED_SOURCE_SEARCH() 
-### 
-### Prevent module using in extended python source search. 
-### Use the macro if module contains python2-only files (or other python sources which shouldn't be imported by python3 interpreter) 
-### which resides in the same directories with python 3 usefull code. contrib/python/future is a example. 
-### Anyway, preferred way is to move such files into separate dir and don't use this macro at all. 
-###
-### Also see: https://docs.yandex-team.ru/ya-make/manual/python/vars#y_python_extended_source_search for details 
-macro NO_EXTENDED_SOURCE_SEARCH() { 
-    SET(NO_EXTENDED_SOURCE_SEARCH yes) 
-} 
- 
+### @usage: NO_EXTENDED_SOURCE_SEARCH()
+###
+### Prevent module using in extended python source search.
+### Use the macro if module contains python2-only files (or other python sources which shouldn't be imported by python3 interpreter)
+### which resides in the same directories with python 3 usefull code. contrib/python/future is a example.
+### Anyway, preferred way is to move such files into separate dir and don't use this macro at all.
+###
+### Also see: https://docs.yandex-team.ru/ya-make/manual/python/vars#y_python_extended_source_search for details
+macro NO_EXTENDED_SOURCE_SEARCH() {
+    SET(NO_EXTENDED_SOURCE_SEARCH yes)
+}
+
 # tag:python-specific
 ### @usage: PY3_PROGRAM([progname])
 ###
@@ -1730,21 +1730,21 @@ macro NO_EXTENDED_SOURCE_SEARCH() {
 ### This only compatible with PYTHON3-tagged modules and selects those from multimodules.
 ###
 ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
-multimodule PY3_PROGRAM { 
-    module PY3_BIN: PY3_PROGRAM_BIN { 
-        .PEERDIRSELF=PY3_BIN_LIB 
-        .IGNORED=RESOURCE RESOURCE_FILES PEERDIR TASKLET_REG 
-        # Notify pybuild to skip almost all PY_SRCS arguments except MAIN 
-        ENABLE(PROCESS_PY_MAIN_ONLY) 
-        _PY_PROGRAM() 
-    } 
- 
-    module PY3_BIN_LIB: PY3_LIBRARY { 
+multimodule PY3_PROGRAM {
+    module PY3_BIN: PY3_PROGRAM_BIN {
+        .PEERDIRSELF=PY3_BIN_LIB
+        .IGNORED=RESOURCE RESOURCE_FILES PEERDIR TASKLET_REG
+        # Notify pybuild to skip almost all PY_SRCS arguments except MAIN
+        ENABLE(PROCESS_PY_MAIN_ONLY)
+        _PY_PROGRAM()
+    }
+
+    module PY3_BIN_LIB: PY3_LIBRARY {
         .IGNORED=RESTRICT_LICENSES
-        # Notify pybuild to skip all python main function definitions 
-        ENABLE(IGNORE_PY_MAIN) 
-        _REQUIRE_EXPLICIT_LICENSE() 
-    } 
+        # Notify pybuild to skip all python main function definitions
+        ENABLE(IGNORE_PY_MAIN)
+        _REQUIRE_EXPLICIT_LICENSE()
+    }
 }
 
 # tag:ycr-specific
@@ -1792,7 +1792,7 @@ PYCR_LINK_EXE=$LINK_EXE && $_PYCR_GENERATE_CONFIGS($MODULE_PREFIX$REALPRJNAME $M
 ###
 ### pycare-specific program module. Generates pycare configs in addition to producing the program.
 ### If name is not specified it will be generated from the name of the containing project directory.
-module PYCR_PROGRAM: PY3_PROGRAM_BIN { 
+module PYCR_PROGRAM: PY3_PROGRAM_BIN {
     .CMD=PYCR_LINK_EXE
 }
 
@@ -2205,12 +2205,12 @@ module PY3TEST_BIN: _BASE_PY3_PROGRAM {
 }
 
 # tag:python-specific tag:test
-### Disable submodules with the specified name(s). 
-### Unlike EXCLUDE_TAGS this variable: 
-### - affects all projects in the build; 
-### - filter by module name and ignore MODULE_TAG. 
-EXCLUDE_SUBMODULES=PY3TEST_LIBRARY 
- 
+### Disable submodules with the specified name(s).
+### Unlike EXCLUDE_TAGS this variable:
+### - affects all projects in the build;
+### - filter by module name and ignore MODULE_TAG.
+EXCLUDE_SUBMODULES=PY3TEST_LIBRARY
+
 # tag:python-specific tag:test
 ### @usage: PY3TEST([name])
 ###
@@ -2221,19 +2221,19 @@ EXCLUDE_SUBMODULES=PY3TEST_LIBRARY
 ###
 ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
 ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
-multimodule PY3TEST { 
-    module PY3TEST_PROGRAM: PY3TEST_BIN { 
-        .FINAL_TARGET=yes 
-    } 
- 
+multimodule PY3TEST {
+    module PY3TEST_PROGRAM: PY3TEST_BIN {
+        .FINAL_TARGET=yes
+    }
+
     module PY3TEST_LIBRARY: _PY3_LIBRARY {
-        PEERDIR+=library/python/pytest 
-        _REQUIRE_EXPLICIT_LICENSE() 
-    } 
+        PEERDIR+=library/python/pytest
+        _REQUIRE_EXPLICIT_LICENSE()
+    }
 }
 
 # tag:cpp-specific tag:test
-module CPP_STYLE_TEST: PY3TEST_BIN { 
+module CPP_STYLE_TEST: PY3TEST_BIN {
     DEPENDS(contrib/libs/clang12/tools/clang-format)
     PEERDIR+=library/python/cpp_test
 }
@@ -4211,16 +4211,16 @@ module _BASE_PY3_PROGRAM: _BASE_PROGRAM {
 }
 
 # tag:python-specific
-### @usage: PY3_PROGRAM_BIN([progname]) 
-### Use instead of PY3_PROGRAM only if ya.make with PY3_PROGRAM() included in another ya.make 
-### In all other cases use PY3_PROGRAM 
-module PY3_PROGRAM_BIN: _BASE_PY3_PROGRAM { 
+### @usage: PY3_PROGRAM_BIN([progname])
+### Use instead of PY3_PROGRAM only if ya.make with PY3_PROGRAM() included in another ya.make
+### In all other cases use PY3_PROGRAM
+module PY3_PROGRAM_BIN: _BASE_PY3_PROGRAM {
     .ALIASES=REQUIREMENTS=PY_REQUIREMENTS
     # Look's like we cannot avoid copy-paste util ymake supports multiple inheritance
     # We need to attach coverage.extractor to every py_program target, except pytest targets
     ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
-} 
- 
+}
+
 # tag:java-specific
 JAVA_SWIG_DELIM=JAVA_SWIG_DELIM
 
@@ -5061,7 +5061,7 @@ multimodule SANDBOX_PY23_TASK {
 ###
 ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
 multimodule SANDBOX_PY3_TASK {
-    module SB_TASK_BIN: PY3_PROGRAM_BIN { 
+    module SB_TASK_BIN: PY3_PROGRAM_BIN {
         PY_MAIN(sandbox.taskbox.binary)
         PEERDIR(sandbox/bin sandbox/sdk2 sandbox/taskbox/worker)
         SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
@@ -5158,7 +5158,7 @@ macro PYTHON3_ADDINCL() {
 macro _ARCADIA_PYTHON3_ADDINCL() {
     _PYTHON3_ADDINCL()
     SET(MODULE_TAG PY3)
-    SET(MODULE_LANG PY3) 
+    SET(MODULE_LANG PY3)
     SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE PY3_PROTO PY3_FBS PY3_SSQLS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
 }
 
@@ -5782,7 +5782,7 @@ macro _SRC("xs", SRC, SRCFLAGS...) {
 # tag:src-processing
 macro _SRC("y", SRC, SRCFLAGS...) {
     # .CMD=${tool:"contrib/tools/byacc"} $BYACC_FLAGS ${nopath;noext;output:SRC.cpp} ${input:SRC} ${nopath;noext;hide;output;addincl:SRC.h} ${kv;hide:"p YC"} ${kv;hide:"pc light-green"}
-    .CMD=${tool:"contrib/tools/bison/bison"} $BISON_FLAGS --m4=${tool:"contrib/tools/bison/m4"} -d -o ${nopath;noext;output;main;hide:SRC.h} ${nopath;noext;output:SRC.cpp} ${input:SRC} ${SRCFLAGS} && $YMAKE_PYTHON ${input:"build/scripts/preprocess.py"} $_ADD_HIDDEN_INPUTS($CPP_BISON_SKELS) ${nopath;noext;output;addincl:SRC.h} ${kv;hide:"p YC"} ${kv;hide:"pc light-green"} 
+    .CMD=${tool:"contrib/tools/bison/bison"} $BISON_FLAGS --m4=${tool:"contrib/tools/bison/m4"} -d -o ${nopath;noext;output;main;hide:SRC.h} ${nopath;noext;output:SRC.cpp} ${input:SRC} ${SRCFLAGS} && $YMAKE_PYTHON ${input:"build/scripts/preprocess.py"} $_ADD_HIDDEN_INPUTS($CPP_BISON_SKELS) ${nopath;noext;output;addincl:SRC.h} ${kv;hide:"p YC"} ${kv;hide:"pc light-green"}
 }
 
 # tag:src-processing
@@ -5797,7 +5797,7 @@ macro _SRC("gperf", SRC, SRCFLAGS...) {
 
 # tag:src-processing
 macro _SRC("rl", SRC, SRCFLAGS...) {
-    .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/ragel"} $RAGEL_FLAGS ${SRCFLAGS} -o ${tmp:SRC.tmp} ${input:SRC} && $RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/rlgen-cd"} $RLGEN_FLAGS -o ${output;nopath;noext;defext=.rl5.cpp:SRC} ${tmp:SRC.tmp} ${kv;hide:"p R5"} ${kv;hide:"pc yellow"} 
+    .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/ragel"} $RAGEL_FLAGS ${SRCFLAGS} -o ${tmp:SRC.tmp} ${input:SRC} && $RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/rlgen-cd"} $RLGEN_FLAGS -o ${output;nopath;noext;defext=.rl5.cpp:SRC} ${tmp:SRC.tmp} ${kv;hide:"p R5"} ${kv;hide:"pc yellow"}
 }
 
 # tag:src-processing
@@ -5995,42 +5995,42 @@ macro _SRC_c_nodeps(SRC, OUTFILE, INC...) {
      .CMD=$_SRC_C_NODEPS_CMD
 }
 
-# Custom flags for generated cpp-files. To support another generator: 
-# - insert additional file extension before .cpp into generated cpp-file name 
-# - update _LANG_CFLAGS_FILTER variable. Don't forget to add ' SKIP ' after flag list 
+# Custom flags for generated cpp-files. To support another generator:
+# - insert additional file extension before .cpp into generated cpp-file name
+# - update _LANG_CFLAGS_FILTER variable. Don't forget to add ' SKIP ' after flag list
 #
 # ragel5 and ragel6 generated terrible code which makes use of goto's in switch statements.
 # This triggers -Werror-implicit-fallthrough due to `unannotated fall-through between switch labels`.
 #
 # cython generated code also fails to pass this diagnostics due to `fallthrough annotation in unreachable code`.
 # We use cython==0.29.26 at the time. This issue might be fixed in further versions.
- 
-## tag:src-processing 
-_LANG_CFLAGS_FILTER=\ 
-    ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \ 
+
+## tag:src-processing
+_LANG_CFLAGS_FILTER=\
+    ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \
     ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl6:SRC} \
     ${pre=-Wno-implicit-fallthrough SKIP ;ext=.pyx:SRC}
- 
+
+# tag:src-processing
+# Magic macro for removing file name from result (file name is passed as unused SKIP parameter)
+macro _FILTER_EXTS(SKIP="", FLAGS...) {
+    .CMD=$FLAGS
+}
+
 # tag:src-processing
-# Magic macro for removing file name from result (file name is passed as unused SKIP parameter) 
-macro _FILTER_EXTS(SKIP="", FLAGS...) { 
-    .CMD=$FLAGS 
-} 
- 
-# tag:src-processing 
-macro _LANG_CFLAGS(SRC) { 
-    .CMD=$_FILTER_EXTS($_LANG_CFLAGS_FILTER) 
-} 
- 
-# tag:src-processing 
-# ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is 
-# Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call 
+macro _LANG_CFLAGS(SRC) {
+    .CMD=$_FILTER_EXTS($_LANG_CFLAGS_FILTER)
+}
+
+# tag:src-processing
+# ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
+# Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
 _LANG_CFLAGS_VALUE=
 when ($CLANG == "yes" || $GCC == "yes") {
     _LANG_CFLAGS_VALUE=$_LANG_CFLAGS(${noext:SRC})
 }
- 
-# tag:src-processing 
+
+# tag:src-processing
 macro _SRC_cpp(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
     .CMD=$_SRC_CPP_CMD
 }
@@ -9022,18 +9022,18 @@ multimodule PY23_TEST {
         CANONIZE_SUB_PATH=py2test
         RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
     }
-    module PY3TEST_PROGRAM: PY3TEST_BIN { 
-        .FINAL_TARGET=yes 
+    module PY3TEST_PROGRAM: PY3TEST_BIN {
+        .FINAL_TARGET=yes
         OBJ_SUF=.py3
         CANONIZE_SUB_PATH=py3test
         RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
     }
- 
+
     module PY3TEST_LIBRARY: _PY3_LIBRARY {
-        PEERDIR+=library/python/pytest 
-        _REQUIRE_EXPLICIT_LICENSE() 
+        PEERDIR+=library/python/pytest
+        _REQUIRE_EXPLICIT_LICENSE()
         RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
-    } 
+    }
 }
 
 # tag:windows-specific

+ 1 - 1
build/ymake_conf.py

@@ -1677,7 +1677,7 @@ class GnuCompiler(Compiler):
             '$COMPILER_TIME_TRACE_FLAGS',
             '$EXTRA_OUTPUT',
             '$SRCFLAGS',
-            '$_LANG_CFLAGS_VALUE', 
+            '$_LANG_CFLAGS_VALUE',
             '${input:SRC}',
             '$TOOLCHAIN_ENV',
             '$YNDEXER_OUTPUT',

+ 1 - 1
contrib/python/future/ya.make

@@ -12,7 +12,7 @@ NO_CHECK_IMPORTS(
 )
 
 NO_LINT()
-NO_EXTENDED_SOURCE_SEARCH() 
+NO_EXTENDED_SOURCE_SEARCH()
 
 PY_SRCS(
     TOP_LEVEL

+ 1 - 1
contrib/python/mypy-protobuf/bin/protoc-gen-mypy/bin/ya.make

@@ -1,6 +1,6 @@
 OWNER(torkve g:python-contrib)
 
-PY3_PROGRAM_BIN(protoc-gen-mypy) 
+PY3_PROGRAM_BIN(protoc-gen-mypy)
 
 PEERDIR(
     contrib/python/mypy-protobuf

+ 1 - 1
contrib/tools/python3/pycc/bin/ya.make

@@ -1,6 +1,6 @@
 OWNER(g:contrib g:ymake orivej)
 
-PY3_PROGRAM_BIN(pycc) 
+PY3_PROGRAM_BIN(pycc)
 
 ENABLE(PYBUILD_NO_PYC)
 

+ 3 - 3
contrib/tools/python3/src/Include/pyconfig.h

@@ -1,7 +1,7 @@
 #pragma once
 
 #ifdef Py_BUILD_CORE
-#define ABIFLAGS "" 
+#define ABIFLAGS ""
 #define PREFIX "/var/empty"
 #define EXEC_PREFIX "/var/empty"
 #define VERSION "3.9"
@@ -11,11 +11,11 @@
 #if defined(__linux__)
 #define PLATFORM "linux"
 #define MULTIARCH "x86_64-linux-gnu"
-#define SOABI "cpython-39-x86_64-linux-gnu" 
+#define SOABI "cpython-39-x86_64-linux-gnu"
 #elif defined(__APPLE__)
 #define PLATFORM "darwin"
 #define MULTIARCH "darwin"
-#define SOABI "cpython-39-darwin" 
+#define SOABI "cpython-39-darwin"
 #endif
 #endif
 

+ 241 - 241
contrib/tools/python3/src/Lib/venv/scripts/common/Activate.ps1

@@ -1,241 +1,241 @@
-<# 
-.Synopsis 
-Activate a Python virtual environment for the current PowerShell session. 
- 
-.Description 
-Pushes the python executable for a virtual environment to the front of the 
-$Env:PATH environment variable and sets the prompt to signify that you are 
-in a Python virtual environment. Makes use of the command line switches as 
-well as the `pyvenv.cfg` file values present in the virtual environment. 
- 
-.Parameter VenvDir 
-Path to the directory that contains the virtual environment to activate. The 
-default value for this is the parent of the directory that the Activate.ps1 
-script is located within. 
- 
-.Parameter Prompt 
-The prompt prefix to display when this virtual environment is activated. By 
-default, this prompt is the name of the virtual environment folder (VenvDir) 
-surrounded by parentheses and followed by a single space (ie. '(.venv) '). 
- 
-.Example 
-Activate.ps1 
-Activates the Python virtual environment that contains the Activate.ps1 script. 
- 
-.Example 
-Activate.ps1 -Verbose 
-Activates the Python virtual environment that contains the Activate.ps1 script, 
-and shows extra information about the activation as it executes. 
- 
-.Example 
-Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv 
-Activates the Python virtual environment located in the specified location. 
- 
-.Example 
-Activate.ps1 -Prompt "MyPython" 
-Activates the Python virtual environment that contains the Activate.ps1 script, 
-and prefixes the current prompt with the specified string (surrounded in 
-parentheses) while the virtual environment is active. 
- 
-.Notes 
-On Windows, it may be required to enable this Activate.ps1 script by setting the 
-execution policy for the user. You can do this by issuing the following PowerShell 
-command: 
- 
-PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser 
- 
-For more information on Execution Policies:  
-https://go.microsoft.com/fwlink/?LinkID=135170 
- 
-#> 
-Param( 
-    [Parameter(Mandatory = $false)] 
-    [String] 
-    $VenvDir, 
-    [Parameter(Mandatory = $false)] 
-    [String] 
-    $Prompt 
-) 
- 
-<# Function declarations --------------------------------------------------- #> 
- 
-<# 
-.Synopsis 
-Remove all shell session elements added by the Activate script, including the 
-addition of the virtual environment's Python executable from the beginning of 
-the PATH variable. 
- 
-.Parameter NonDestructive 
-If present, do not remove this function from the global namespace for the 
-session. 
- 
-#> 
-function global:deactivate ([switch]$NonDestructive) { 
-    # Revert to original values 
- 
-    # The prior prompt: 
-    if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { 
-        Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt 
-        Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT 
-    } 
- 
-    # The prior PYTHONHOME: 
-    if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { 
-        Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME 
-        Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME 
-    } 
- 
-    # The prior PATH: 
-    if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { 
-        Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH 
-        Remove-Item -Path Env:_OLD_VIRTUAL_PATH 
-    } 
- 
-    # Just remove the VIRTUAL_ENV altogether: 
-    if (Test-Path -Path Env:VIRTUAL_ENV) { 
-        Remove-Item -Path env:VIRTUAL_ENV 
-    } 
- 
-    # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: 
-    if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { 
-        Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force 
-    } 
- 
-    # Leave deactivate function in the global namespace if requested: 
-    if (-not $NonDestructive) { 
-        Remove-Item -Path function:deactivate 
-    } 
-} 
- 
-<# 
-.Description 
-Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the 
-given folder, and returns them in a map. 
- 
-For each line in the pyvenv.cfg file, if that line can be parsed into exactly 
-two strings separated by `=` (with any amount of whitespace surrounding the =) 
-then it is considered a `key = value` line. The left hand string is the key, 
-the right hand is the value. 
- 
-If the value starts with a `'` or a `"` then the first and last character is 
-stripped from the value before being captured. 
- 
-.Parameter ConfigDir 
-Path to the directory that contains the `pyvenv.cfg` file. 
-#> 
-function Get-PyVenvConfig( 
-    [String] 
-    $ConfigDir 
-) { 
-    Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" 
- 
-    # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). 
-    $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue 
- 
-    # An empty map will be returned if no config file is found. 
-    $pyvenvConfig = @{ } 
- 
-    if ($pyvenvConfigPath) { 
- 
-        Write-Verbose "File exists, parse `key = value` lines" 
-        $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath 
- 
-        $pyvenvConfigContent | ForEach-Object { 
-            $keyval = $PSItem -split "\s*=\s*", 2 
-            if ($keyval[0] -and $keyval[1]) { 
-                $val = $keyval[1] 
- 
-                # Remove extraneous quotations around a string value. 
-                if ("'""".Contains($val.Substring(0, 1))) { 
-                    $val = $val.Substring(1, $val.Length - 2) 
-                } 
- 
-                $pyvenvConfig[$keyval[0]] = $val 
-                Write-Verbose "Adding Key: '$($keyval[0])'='$val'" 
-            } 
-        } 
-    } 
-    return $pyvenvConfig 
-} 
- 
- 
-<# Begin Activate script --------------------------------------------------- #> 
- 
-# Determine the containing directory of this script 
-$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition 
-$VenvExecDir = Get-Item -Path $VenvExecPath 
- 
-Write-Verbose "Activation script is located in path: '$VenvExecPath'" 
-Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" 
-Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" 
- 
-# Set values required in priority: CmdLine, ConfigFile, Default 
-# First, get the location of the virtual environment, it might not be 
-# VenvExecDir if specified on the command line. 
-if ($VenvDir) { 
-    Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" 
-} 
-else { 
-    Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." 
-    $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") 
-    Write-Verbose "VenvDir=$VenvDir" 
-} 
- 
-# Next, read the `pyvenv.cfg` file to determine any required value such 
-# as `prompt`. 
-$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir 
- 
-# Next, set the prompt from the command line, or the config file, or 
-# just use the name of the virtual environment folder. 
-if ($Prompt) { 
-    Write-Verbose "Prompt specified as argument, using '$Prompt'" 
-} 
-else { 
-    Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" 
-    if ($pyvenvCfg -and $pyvenvCfg['prompt']) { 
-        Write-Verbose "  Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" 
-        $Prompt = $pyvenvCfg['prompt']; 
-    } 
-    else { 
-        Write-Verbose "  Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)" 
-        Write-Verbose "  Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" 
-        $Prompt = Split-Path -Path $venvDir -Leaf 
-    } 
-} 
- 
-Write-Verbose "Prompt = '$Prompt'" 
-Write-Verbose "VenvDir='$VenvDir'" 
- 
-# Deactivate any currently active virtual environment, but leave the 
-# deactivate function in place. 
-deactivate -nondestructive 
- 
-# Now set the environment variable VIRTUAL_ENV, used by many tools to determine 
-# that there is an activated venv. 
-$env:VIRTUAL_ENV = $VenvDir 
- 
-if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { 
- 
-    Write-Verbose "Setting prompt to '$Prompt'" 
- 
-    # Set the prompt to include the env name 
-    # Make sure _OLD_VIRTUAL_PROMPT is global 
-    function global:_OLD_VIRTUAL_PROMPT { "" } 
-    Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT 
-    New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt 
- 
-    function global:prompt { 
-        Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " 
-        _OLD_VIRTUAL_PROMPT 
-    } 
-} 
- 
-# Clear PYTHONHOME 
-if (Test-Path -Path Env:PYTHONHOME) { 
-    Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME 
-    Remove-Item -Path Env:PYTHONHOME 
-} 
- 
-# Add the venv to the PATH 
-Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH 
-$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" 
+<#
+.Synopsis
+Activate a Python virtual environment for the current PowerShell session.
+
+.Description
+Pushes the python executable for a virtual environment to the front of the
+$Env:PATH environment variable and sets the prompt to signify that you are
+in a Python virtual environment. Makes use of the command line switches as
+well as the `pyvenv.cfg` file values present in the virtual environment.
+
+.Parameter VenvDir
+Path to the directory that contains the virtual environment to activate. The
+default value for this is the parent of the directory that the Activate.ps1
+script is located within.
+
+.Parameter Prompt
+The prompt prefix to display when this virtual environment is activated. By
+default, this prompt is the name of the virtual environment folder (VenvDir)
+surrounded by parentheses and followed by a single space (ie. '(.venv) ').
+
+.Example
+Activate.ps1
+Activates the Python virtual environment that contains the Activate.ps1 script.
+
+.Example
+Activate.ps1 -Verbose
+Activates the Python virtual environment that contains the Activate.ps1 script,
+and shows extra information about the activation as it executes.
+
+.Example
+Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
+Activates the Python virtual environment located in the specified location.
+
+.Example
+Activate.ps1 -Prompt "MyPython"
+Activates the Python virtual environment that contains the Activate.ps1 script,
+and prefixes the current prompt with the specified string (surrounded in
+parentheses) while the virtual environment is active.
+
+.Notes
+On Windows, it may be required to enable this Activate.ps1 script by setting the
+execution policy for the user. You can do this by issuing the following PowerShell
+command:
+
+PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
+
+For more information on Execution Policies: 
+https://go.microsoft.com/fwlink/?LinkID=135170
+
+#>
+Param(
+    [Parameter(Mandatory = $false)]
+    [String]
+    $VenvDir,
+    [Parameter(Mandatory = $false)]
+    [String]
+    $Prompt
+)
+
+<# Function declarations --------------------------------------------------- #>
+
+<#
+.Synopsis
+Remove all shell session elements added by the Activate script, including the
+addition of the virtual environment's Python executable from the beginning of
+the PATH variable.
+
+.Parameter NonDestructive
+If present, do not remove this function from the global namespace for the
+session.
+
+#>
+function global:deactivate ([switch]$NonDestructive) {
+    # Revert to original values
+
+    # The prior prompt:
+    if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
+        Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
+        Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
+    }
+
+    # The prior PYTHONHOME:
+    if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
+        Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
+        Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
+    }
+
+    # The prior PATH:
+    if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
+        Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
+        Remove-Item -Path Env:_OLD_VIRTUAL_PATH
+    }
+
+    # Just remove the VIRTUAL_ENV altogether:
+    if (Test-Path -Path Env:VIRTUAL_ENV) {
+        Remove-Item -Path env:VIRTUAL_ENV
+    }
+
+    # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
+    if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
+        Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
+    }
+
+    # Leave deactivate function in the global namespace if requested:
+    if (-not $NonDestructive) {
+        Remove-Item -Path function:deactivate
+    }
+}
+
+<#
+.Description
+Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
+given folder, and returns them in a map.
+
+For each line in the pyvenv.cfg file, if that line can be parsed into exactly
+two strings separated by `=` (with any amount of whitespace surrounding the =)
+then it is considered a `key = value` line. The left hand string is the key,
+the right hand is the value.
+
+If the value starts with a `'` or a `"` then the first and last character is
+stripped from the value before being captured.
+
+.Parameter ConfigDir
+Path to the directory that contains the `pyvenv.cfg` file.
+#>
+function Get-PyVenvConfig(
+    [String]
+    $ConfigDir
+) {
+    Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
+
+    # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
+    $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
+
+    # An empty map will be returned if no config file is found.
+    $pyvenvConfig = @{ }
+
+    if ($pyvenvConfigPath) {
+
+        Write-Verbose "File exists, parse `key = value` lines"
+        $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
+
+        $pyvenvConfigContent | ForEach-Object {
+            $keyval = $PSItem -split "\s*=\s*", 2
+            if ($keyval[0] -and $keyval[1]) {
+                $val = $keyval[1]
+
+                # Remove extraneous quotations around a string value.
+                if ("'""".Contains($val.Substring(0, 1))) {
+                    $val = $val.Substring(1, $val.Length - 2)
+                }
+
+                $pyvenvConfig[$keyval[0]] = $val
+                Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
+            }
+        }
+    }
+    return $pyvenvConfig
+}
+
+
+<# Begin Activate script --------------------------------------------------- #>
+
+# Determine the containing directory of this script
+$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
+$VenvExecDir = Get-Item -Path $VenvExecPath
+
+Write-Verbose "Activation script is located in path: '$VenvExecPath'"
+Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
+Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
+
+# Set values required in priority: CmdLine, ConfigFile, Default
+# First, get the location of the virtual environment, it might not be
+# VenvExecDir if specified on the command line.
+if ($VenvDir) {
+    Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
+}
+else {
+    Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
+    $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
+    Write-Verbose "VenvDir=$VenvDir"
+}
+
+# Next, read the `pyvenv.cfg` file to determine any required value such
+# as `prompt`.
+$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
+
+# Next, set the prompt from the command line, or the config file, or
+# just use the name of the virtual environment folder.
+if ($Prompt) {
+    Write-Verbose "Prompt specified as argument, using '$Prompt'"
+}
+else {
+    Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
+    if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
+        Write-Verbose "  Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
+        $Prompt = $pyvenvCfg['prompt'];
+    }
+    else {
+        Write-Verbose "  Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
+        Write-Verbose "  Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
+        $Prompt = Split-Path -Path $venvDir -Leaf
+    }
+}
+
+Write-Verbose "Prompt = '$Prompt'"
+Write-Verbose "VenvDir='$VenvDir'"
+
+# Deactivate any currently active virtual environment, but leave the
+# deactivate function in place.
+deactivate -nondestructive
+
+# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
+# that there is an activated venv.
+$env:VIRTUAL_ENV = $VenvDir
+
+if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
+
+    Write-Verbose "Setting prompt to '$Prompt'"
+
+    # Set the prompt to include the env name
+    # Make sure _OLD_VIRTUAL_PROMPT is global
+    function global:_OLD_VIRTUAL_PROMPT { "" }
+    Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
+    New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
+
+    function global:prompt {
+        Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
+        _OLD_VIRTUAL_PROMPT
+    }
+}
+
+# Clear PYTHONHOME
+if (Test-Path -Path Env:PYTHONHOME) {
+    Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
+    Remove-Item -Path Env:PYTHONHOME
+}
+
+# Add the venv to the PATH
+Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
+$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"

+ 66 - 66
contrib/tools/python3/src/Lib/venv/scripts/common/activate

@@ -1,66 +1,66 @@
-# This file must be used with "source bin/activate" *from bash* 
-# you cannot run it directly 
- 
-deactivate () { 
-    # reset old environment variables 
-    if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then 
-        PATH="${_OLD_VIRTUAL_PATH:-}" 
-        export PATH 
-        unset _OLD_VIRTUAL_PATH 
-    fi 
-    if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then 
-        PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" 
-        export PYTHONHOME 
-        unset _OLD_VIRTUAL_PYTHONHOME 
-    fi 
- 
-    # This should detect bash and zsh, which have a hash command that must 
-    # be called to get it to forget past commands.  Without forgetting 
-    # past commands the $PATH changes we made may not be respected 
-    if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then 
-        hash -r 2> /dev/null 
-    fi 
- 
-    if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then 
-        PS1="${_OLD_VIRTUAL_PS1:-}" 
-        export PS1 
-        unset _OLD_VIRTUAL_PS1 
-    fi 
- 
-    unset VIRTUAL_ENV 
-    if [ ! "${1:-}" = "nondestructive" ] ; then 
-    # Self destruct! 
-        unset -f deactivate 
-    fi 
-} 
- 
-# unset irrelevant variables 
-deactivate nondestructive 
- 
-VIRTUAL_ENV="__VENV_DIR__" 
-export VIRTUAL_ENV 
- 
-_OLD_VIRTUAL_PATH="$PATH" 
-PATH="$VIRTUAL_ENV/__VENV_BIN_NAME__:$PATH" 
-export PATH 
- 
-# unset PYTHONHOME if set 
-# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) 
-# could use `if (set -u; : $PYTHONHOME) ;` in bash 
-if [ -n "${PYTHONHOME:-}" ] ; then 
-    _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" 
-    unset PYTHONHOME 
-fi 
- 
-if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then 
-    _OLD_VIRTUAL_PS1="${PS1:-}" 
-    PS1="__VENV_PROMPT__${PS1:-}" 
-    export PS1 
-fi 
- 
-# This should detect bash and zsh, which have a hash command that must 
-# be called to get it to forget past commands.  Without forgetting 
-# past commands the $PATH changes we made may not be respected 
-if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then 
-    hash -r 2> /dev/null 
-fi 
+# This file must be used with "source bin/activate" *from bash*
+# you cannot run it directly
+
+deactivate () {
+    # reset old environment variables
+    if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
+        PATH="${_OLD_VIRTUAL_PATH:-}"
+        export PATH
+        unset _OLD_VIRTUAL_PATH
+    fi
+    if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
+        PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
+        export PYTHONHOME
+        unset _OLD_VIRTUAL_PYTHONHOME
+    fi
+
+    # This should detect bash and zsh, which have a hash command that must
+    # be called to get it to forget past commands.  Without forgetting
+    # past commands the $PATH changes we made may not be respected
+    if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
+        hash -r 2> /dev/null
+    fi
+
+    if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
+        PS1="${_OLD_VIRTUAL_PS1:-}"
+        export PS1
+        unset _OLD_VIRTUAL_PS1
+    fi
+
+    unset VIRTUAL_ENV
+    if [ ! "${1:-}" = "nondestructive" ] ; then
+    # Self destruct!
+        unset -f deactivate
+    fi
+}
+
+# unset irrelevant variables
+deactivate nondestructive
+
+VIRTUAL_ENV="__VENV_DIR__"
+export VIRTUAL_ENV
+
+_OLD_VIRTUAL_PATH="$PATH"
+PATH="$VIRTUAL_ENV/__VENV_BIN_NAME__:$PATH"
+export PATH
+
+# unset PYTHONHOME if set
+# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
+# could use `if (set -u; : $PYTHONHOME) ;` in bash
+if [ -n "${PYTHONHOME:-}" ] ; then
+    _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
+    unset PYTHONHOME
+fi
+
+if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
+    _OLD_VIRTUAL_PS1="${PS1:-}"
+    PS1="__VENV_PROMPT__${PS1:-}"
+    export PS1
+fi
+
+# This should detect bash and zsh, which have a hash command that must
+# be called to get it to forget past commands.  Without forgetting
+# past commands the $PATH changes we made may not be respected
+if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
+    hash -r 2> /dev/null
+fi

Some files were not shown because too many files changed in this diff