tauto - rm all common.py to support proper packaging (2)

this absolutely breaks everything, but a follow up will fix

BUG=b:192594749
TEST=None, because this intentionally broke alot of stuff

Change-Id: I599a004b3ca9e7bb621ff39c02721fcd247a7e69
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/tauto/+/3195035
Reviewed-by: Jesse McGuire <jessemcguire@google.com>
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
Tested-by: Derek Beckett <dbeckett@chromium.org>
diff --git a/src/tauto/client/bin/common.py b/src/tauto/client/bin/common.py
deleted file mode 100644
index 6881386..0000000
--- a/src/tauto/client/bin/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, ".."))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
diff --git a/src/tauto/client/bin/result_tools/common.py b/src/tauto/client/bin/result_tools/common.py
deleted file mode 100644
index 7443052..0000000
--- a/src/tauto/client/bin/result_tools/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "../.."))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
diff --git a/src/tauto/client/common_lib/common.py b/src/tauto/client/common_lib/common.py
deleted file mode 100644
index 6881386..0000000
--- a/src/tauto/client/common_lib/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, ".."))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
diff --git a/src/tauto/client/common_lib/cros/common.py b/src/tauto/client/common_lib/cros/common.py
deleted file mode 100644
index ce78b85..0000000
--- a/src/tauto/client/common_lib/cros/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "..", ".."))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
diff --git a/src/tauto/client/common_lib/cros/network/common.py b/src/tauto/client/common_lib/cros/network/common.py
deleted file mode 100644
index 849be4d..0000000
--- a/src/tauto/client/common_lib/cros/network/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "..", "..", ".."))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
diff --git a/src/tauto/client/common_lib/hosts/common.py b/src/tauto/client/common_lib/hosts/common.py
deleted file mode 100644
index ce78b85..0000000
--- a/src/tauto/client/common_lib/hosts/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "..", ".."))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
diff --git a/src/tauto/client/common_lib/test_utils/common.py b/src/tauto/client/common_lib/test_utils/common.py
deleted file mode 100644
index 0eb5e60..0000000
--- a/src/tauto/client/common_lib/test_utils/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "..", ".."))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
\ No newline at end of file
diff --git a/src/tauto/client/cros/common.py b/src/tauto/client/cros/common.py
deleted file mode 100644
index 2c19d78..0000000
--- a/src/tauto/client/cros/common.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""This module provides access to the autotest_lib.client namespace. It must be
-   included before any of the modules from that namespace."""
-
-import os, sys
-
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, ".."))
-sys.path.insert(0, client_dir)
-
-import setup_modules
-
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
diff --git a/src/tauto/client/setup_modules.py b/src/tauto/client/setup_modules.py
deleted file mode 100644
index 15b8108..0000000
--- a/src/tauto/client/setup_modules.py
+++ /dev/null
@@ -1,247 +0,0 @@
-import os
-import re
-import sys
-
-# This must run on Python versions less than 2.4.
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-common_dir = os.path.abspath(os.path.join(dirname, 'common_lib'))
-sys.path.insert(0, common_dir)
-import check_version
-sys.path.pop(0)
-
-
-def _get_pyversion_from_args():
-    """Extract, format, & pop the current py_version from args, if provided."""
-    py_version = 3
-    py_version_re = re.compile(r'--py_version=(\w+)\b')
-
-    version_found = False
-    for i, arg in enumerate(sys.argv):
-        if not arg.startswith('--py_version'):
-            continue
-        result = py_version_re.search(arg)
-        if result:
-            if version_found:
-                raise ValueError('--py_version may only be specified once.')
-            py_version = result.group(1)
-            version_found = True
-            if py_version not in ('2', '3'):
-                raise ValueError('Python version must be "2" or "3".')
-
-            # Remove the arg so other argparsers don't get grumpy.
-            sys.argv.pop(i)
-
-    return py_version
-
-
-def _desired_version():
-    """
-    Returns desired python version.
-
-    If the PY_VERSION env var is set, just return that. This is the case
-    when autoserv kicks of autotest on the server side via a job.run(), or
-    a process created a subprocess.
-
-    Otherwise, parse & pop the sys.argv for the '--py_version' flag. If no
-    flag is set, default to python 2 (for now).
-
-    """
-    # Even if the arg is in the env vars, we will attempt to get it from the
-    # args, so that it can be popped prior to other argparsers hitting.
-    py_version = _get_pyversion_from_args()
-
-    if os.getenv('PY_VERSION'):
-        return int(os.getenv('PY_VERSION'))
-
-    os.environ['PY_VERSION'] = str(py_version)
-    return int(py_version)
-
-
-desired_version = _desired_version()
-if desired_version == sys.version_info.major:
-    os.environ['AUTOTEST_NO_RESTART'] = 'True'
-else:
-    # There are cases were this can be set (ie by test_that), but a subprocess
-    # is launched in the incorrect version.
-    if os.getenv('AUTOTEST_NO_RESTART'):
-        del os.environ['AUTOTEST_NO_RESTART']
-    check_version.check_python_version(desired_version)
-
-import glob, traceback, types
-
-
-def import_module(module, from_where):
-    """Equivalent to 'from from_where import module'
-    Returns the corresponding module"""
-    from_module = __import__(from_where, globals(), locals(), [module])
-    return getattr(from_module, module)
-
-
-def _autotest_logging_handle_error(self, record):
-    """Method to monkey patch into logging.Handler to replace handleError."""
-    # The same as the default logging.Handler.handleError but also prints
-    # out the original record causing the error so there is -some- idea
-    # about which call caused the logging error.
-    import logging
-    if logging.raiseExceptions:
-        # Avoid recursion as the below output can end up back in here when
-        # something has *seriously* gone wrong in autotest.
-        logging.raiseExceptions = 0
-        sys.stderr.write('Exception occurred formatting message: '
-                         '%r using args %r\n' % (record.msg, record.args))
-        traceback.print_stack()
-        sys.stderr.write('-' * 50 + '\n')
-        traceback.print_exc()
-        sys.stderr.write('Future logging formatting exceptions disabled.\n')
-
-
-def _monkeypatch_logging_handle_error():
-    # Hack out logging.py*
-    logging_py = os.path.join(os.path.dirname(__file__), 'common_lib',
-                              'logging.py*')
-    if glob.glob(logging_py):
-        os.system('rm -f %s' % logging_py)
-
-    # Monkey patch our own handleError into the logging module's StreamHandler.
-    # A nicer way of doing this -might- be to have our own logging module define
-    # an autotest Logger instance that added our own Handler subclass with this
-    # handleError method in it.  But that would mean modifying tons of code.
-    import logging
-    assert callable(logging.Handler.handleError)
-    logging.Handler.handleError = _autotest_logging_handle_error
-
-
-def _insert_site_packages(root):
-    # Allow locally installed third party packages to be found
-    # before any that are installed on the system itself when not.
-    # running as a client.
-    # This is primarily for the benefit of frontend and tko so that they
-    # may use libraries other than those available as system packages.
-    sys.path.insert(0, os.path.join(root, 'site-packages'))
-
-
-import importlib
-
-ROOT_MODULE_NAME_ALLOW_LIST = (
-        'autotest_lib',
-        'autotest_lib.client',
-)
-
-
-def _setup_top_level_symlink(base_path):
-    """Create a self pointing symlink in the base_path)."""
-    if os.path.islink(os.path.join(base_path, 'autotest_lib')):
-        return
-    os.chdir(base_path)
-    os.symlink('.', 'autotest_lib')
-
-
-def _setup_client_symlink(base_path):
-    """Setup the client symlink for the DUT.
-
-    Creates a "autotest_lib" folder in client, then creates a symlink called
-    "client" pointing back to ../, as well as an __init__ for the folder.
-    """
-
-    def _create_client_symlink():
-        os.chdir(autotest_lib_dir)
-        with open('__init__.py', 'w'):
-            pass
-        os.symlink('../', 'client')
-
-    autotest_lib_dir = os.path.join(base_path, 'autotest_lib')
-
-    if os.path.isdir(autotest_lib_dir):
-        if os.path.islink(os.path.join(autotest_lib_dir, 'client')):
-            return
-        _create_client_symlink()
-        return
-    os.mkdir(autotest_lib_dir)
-    _create_client_symlink()
-
-
-def _symlink_check(base_path, root_dir):
-    """Verify the required symlinks are present, and add them if not."""
-    # Note the starting cwd to later change back to it.
-    starting_dir = os.getcwd()
-    if root_dir == 'autotest_lib':
-        _setup_top_level_symlink(base_path)
-    elif root_dir == 'autotest_lib.client':
-        _setup_client_symlink(base_path)
-
-    os.chdir(starting_dir)
-
-
-def setup(base_path, root_module_name):
-    _symlink_check(base_path, root_module_name)
-    if root_module_name not in ROOT_MODULE_NAME_ALLOW_LIST:
-        raise Exception('Unexpected root module: ' + root_module_name)
-
-    _insert_site_packages(base_path)
-
-    # Ie, server (or just not /client)
-    if root_module_name == 'autotest_lib':
-        # Base path is just x/x/x/x/autotest/files
-        _setup_autotest_lib(base_path)
-        _preimport_top_level_packages(os.path.join(base_path, 'autotest_lib'),
-                                      parent='autotest_lib')
-    else:  # aka, in /client/
-        if os.path.exists(os.path.join(os.path.dirname(base_path), 'server')):
-
-            # Takes you from /client/ to /files
-            # this is because on DUT there is no files/client
-            autotest_base_path = os.path.dirname(base_path)
-
-        else:
-            autotest_base_path = base_path
-
-        _setup_autotest_lib(autotest_base_path)
-        _preimport_top_level_packages(os.path.join(autotest_base_path,
-                                                   'autotest_lib'),
-                                      parent='autotest_lib')
-        _preimport_top_level_packages(
-                os.path.join(autotest_base_path, 'autotest_lib', 'client'),
-                parent='autotest_lib.client',
-        )
-
-    _monkeypatch_logging_handle_error()
-
-
-def _setup_autotest_lib(path):
-    sys.path.insert(0, path)
-    # This is a symlink back to the root directory, that does all the magic.
-    importlib.import_module('autotest_lib')
-    sys.path.pop(0)
-
-
-def _preimport_top_level_packages(root, parent):
-    # The old code to setup the packages used to fetch the top-level packages
-    # inside autotest_lib. We keep that behaviour in order to avoid having to
-    # add import statements for the top-level packages all over the codebase.
-    #
-    # e.g.,
-    #  import common
-    #  from autotest_lib.server import utils
-    #
-    # must continue to work. The _right_ way to do that import would be.
-    #
-    #  import common
-    #  import autotest_lib.server
-    #  from autotest_lib.server import utils
-    names = []
-    for filename in os.listdir(root):
-        path = os.path.join(root, filename)
-        if not os.path.isdir(path):
-            continue  # skip files
-        if '.' in filename:
-            continue  # if "." is in the name it's not a valid package name
-        if not os.access(path, os.R_OK | os.X_OK):
-            continue  # need read + exec access to make a dir importable
-        if '__init__.py' in os.listdir(path):
-            names.append(filename)
-
-    for name in names:
-        pname = parent + '.' + name
-        importlib.import_module(pname)
-        if name != 'autotest_lib':
-            sys.modules[name] = sys.modules[pname]
diff --git a/src/tauto/client/setup_modules_unittest.py b/src/tauto/client/setup_modules_unittest.py
deleted file mode 100755
index 966ae33..0000000
--- a/src/tauto/client/setup_modules_unittest.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/python3
-
-import logging, os, sys, unittest
-from io import StringIO
-
-# direct imports; autotest_lib has not been setup while testing this.
-from client.common_lib.test_utils import mock
-from client import setup_modules
-
-
-class LoggingErrorStderrTests(unittest.TestCase):
-    """Test the setup_modules."""
-
-    def setUp(self):
-        autotest_dir = os.path.abspath(os.path.join(setup_modules.dirname,
-                                                    '..'))
-        setup_modules.setup(autotest_dir, root_module_name='autotest_lib')
-        self.god = mock.mock_god()
-        self.test_stderr = StringIO()
-        self.god.stub_with(sys, 'stderr', self.test_stderr)
-        self.old_root_logging_level = logging.root.level
-        logging.basicConfig(level=logging.ERROR)
-        # _autotest_logging_handle_error unsets this after being called once.
-        logging.raiseExceptions = 1
-
-    def tearDown(self):
-        self.god.unstub_all()
-        # Undo the setUp logging.basicConfig call.
-        logging.basicConfig(level=self.old_root_logging_level)
-
-    def assert_autotest_logging_handle_error_called(self):
-        self.stderr_str = self.test_stderr.getvalue()
-        self.assertTrue('Exception occurred formatting' in self.stderr_str,
-                        repr(self.stderr_str))
-
-    def test_autotest_logging_handle_error(self):
-        record = logging.LogRecord(
-                'test', logging.DEBUG, __file__, 0, 'MESSAGE', 'ARGS', None)
-        try:
-            raise RuntimeError('Exception context needed for the test.')
-        except RuntimeError:
-            setup_modules._autotest_logging_handle_error(logging.Handler(),
-                                                         record)
-        else:
-            self.fail()
-        self.assert_autotest_logging_handle_error_called()
-        stderr_repr = repr(self.stderr_str)
-        self.assertTrue(('MESSAGE' in self.stderr_str), stderr_repr)
-        self.assertTrue(('ARGS' in self.stderr_str), stderr_repr)
-        self.assertTrue(('Exception' in self.stderr_str), stderr_repr)
-        self.assertTrue(('setup_modules_unittest.py' in self.stderr_str),
-                        stderr_repr)
-        self.assertTrue(('disabled.\n' in self.stderr_str), stderr_repr)
-        # Make sure this was turned off by our handle_error.
-        self.assertFalse(logging.raiseExceptions)
-
-    def test_logging_monkey_patch_wrong_number_of_args(self):
-        logging.error('logging unittest %d %s', 32)
-        self.assert_autotest_logging_handle_error_called()
-        self.assertTrue('logging unittest' in self.stderr_str,
-                        repr(self.stderr_str))
-
-    def test_logging_monkey_patch_wrong_type_of_arg(self):
-        logging.error('logging unittest %d', 'eighteen')
-        self.assert_autotest_logging_handle_error_called()
-        self.assertTrue('logging unittest' in self.stderr_str,
-                        repr(self.stderr_str))
-
-    def test_logging_no_error(self):
-        logging.error('logging unittest.  %s %s', 'meep', 'meep!')
-        self.assertEqual('', self.test_stderr.getvalue())
-
-
-if __name__ == "__main__":
-    unittest.main()
diff --git a/src/tauto/client/tools/common.py b/src/tauto/client/tools/common.py
deleted file mode 100644
index 6881386..0000000
--- a/src/tauto/client/tools/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, ".."))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
diff --git a/src/tauto/common.py b/src/tauto/common.py
deleted file mode 100644
index 48676a7..0000000
--- a/src/tauto/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(dirname)
-client_dir = os.path.join(autotest_dir, "client")
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name="autotest_lib")
diff --git a/src/tauto/server/common.py b/src/tauto/server/common.py
deleted file mode 100644
index 9941b19..0000000
--- a/src/tauto/server/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, ".."))
-client_dir = os.path.join(autotest_dir, "client")
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name="autotest_lib")
diff --git a/src/tauto/server/consts/common.py b/src/tauto/server/consts/common.py
deleted file mode 100644
index 41607e1..0000000
--- a/src/tauto/server/consts/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, "..", ".."))
-client_dir = os.path.join(autotest_dir, "client")
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name="autotest_lib")
diff --git a/src/tauto/server/cros/common.py b/src/tauto/server/cros/common.py
deleted file mode 100644
index 1fa1747..0000000
--- a/src/tauto/server/cros/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, os.pardir, os.pardir))
-client_dir = os.path.join(autotest_dir, 'client')
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name='autotest_lib')
diff --git a/src/tauto/server/cros/dynamic_suite/common.py b/src/tauto/server/cros/dynamic_suite/common.py
deleted file mode 100644
index 6a6c620..0000000
--- a/src/tauto/server/cros/dynamic_suite/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, "../../.."))
-client_dir = os.path.join(autotest_dir, "client")
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name="autotest_lib")
diff --git a/src/tauto/server/cros/servo/keyboard/common.py b/src/tauto/server/cros/servo/keyboard/common.py
deleted file mode 100644
index 90fbb54..0000000
--- a/src/tauto/server/cros/servo/keyboard/common.py
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/python3
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Build relative paths for files with root of autotest_lib.
-
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, '../../../..'))
-client_dir = os.path.join(autotest_dir, 'client')
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name='autotest_lib')
diff --git a/src/tauto/server/cros/servo/topology/common.py b/src/tauto/server/cros/servo/topology/common.py
deleted file mode 100644
index 90fbb54..0000000
--- a/src/tauto/server/cros/servo/topology/common.py
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/python3
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Build relative paths for files with root of autotest_lib.
-
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, '../../../..'))
-client_dir = os.path.join(autotest_dir, 'client')
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name='autotest_lib')
diff --git a/src/tauto/server/hosts/common.py b/src/tauto/server/hosts/common.py
deleted file mode 100644
index 41607e1..0000000
--- a/src/tauto/server/hosts/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, "..", ".."))
-client_dir = os.path.join(autotest_dir, "client")
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name="autotest_lib")
diff --git a/src/tauto/server/lib/common.py b/src/tauto/server/lib/common.py
deleted file mode 100644
index 1fa1747..0000000
--- a/src/tauto/server/lib/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, os.pardir, os.pardir))
-client_dir = os.path.join(autotest_dir, 'client')
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name='autotest_lib')
diff --git a/src/tauto/site_utils/admin/common.py b/src/tauto/site_utils/admin/common.py
deleted file mode 100644
index 41607e1..0000000
--- a/src/tauto/site_utils/admin/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, "..", ".."))
-client_dir = os.path.join(autotest_dir, "client")
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name="autotest_lib")
diff --git a/src/tauto/site_utils/common.py b/src/tauto/site_utils/common.py
deleted file mode 100644
index 9941b19..0000000
--- a/src/tauto/site_utils/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, ".."))
-client_dir = os.path.join(autotest_dir, "client")
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name="autotest_lib")
diff --git a/src/tauto/site_utils/lib/common.py b/src/tauto/site_utils/lib/common.py
deleted file mode 100644
index 1fa1747..0000000
--- a/src/tauto/site_utils/lib/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, os.pardir, os.pardir))
-client_dir = os.path.join(autotest_dir, 'client')
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name='autotest_lib')
diff --git a/src/tauto/site_utils/presubmit_hooks/common.py b/src/tauto/site_utils/presubmit_hooks/common.py
deleted file mode 100644
index 41607e1..0000000
--- a/src/tauto/site_utils/presubmit_hooks/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, "..", ".."))
-client_dir = os.path.join(autotest_dir, "client")
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name="autotest_lib")
diff --git a/src/tauto/utils/common.py b/src/tauto/utils/common.py
deleted file mode 100644
index 9941b19..0000000
--- a/src/tauto/utils/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, ".."))
-client_dir = os.path.join(autotest_dir, "client")
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name="autotest_lib")
diff --git a/src/tauto/utils/modelviz/common.py b/src/tauto/utils/modelviz/common.py
deleted file mode 100644
index 41607e1..0000000
--- a/src/tauto/utils/modelviz/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, "..", ".."))
-client_dir = os.path.join(autotest_dir, "client")
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name="autotest_lib")
diff --git a/src/tauto/utils/side_effects/common.py b/src/tauto/utils/side_effects/common.py
deleted file mode 100644
index 41607e1..0000000
--- a/src/tauto/utils/side_effects/common.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-autotest_dir = os.path.abspath(os.path.join(dirname, "..", ".."))
-client_dir = os.path.join(autotest_dir, "client")
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=autotest_dir, root_module_name="autotest_lib")
diff --git a/venv/OWNERS b/venv/OWNERS
deleted file mode 100644
index ee122c0..0000000
--- a/venv/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /OWNERS
diff --git a/venv/autotest_lib b/venv/autotest_lib
deleted file mode 120000
index b870225..0000000
--- a/venv/autotest_lib
+++ /dev/null
@@ -1 +0,0 @@
-../
\ No newline at end of file