diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index 6dbb609ec05fbb4e06ad3379c8c1f0b04f3e7b67..f12758a354d163e3a152ff137c9a4a1503d6faac 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -31,7 +31,7 @@ def validate_python(): def ensure_config_path(config_dir): """Validate the configuration directory.""" import homeassistant.config as config_util - lib_dir = os.path.join(config_dir, 'lib') + lib_dir = os.path.join(config_dir, 'deps') # Test if configuration directory exists if not os.path.isdir(config_dir): diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 2ba0681c2d65b9d72ca044d6151a0da289bb7ead..7be0c9dd37165bfbd24ebdc7e59abf1c3a1e2f4d 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -65,7 +65,7 @@ def _handle_requirements(hass, component, name): return True for req in component.REQUIREMENTS: - if not pkg_util.install_package(req, target=hass.config.path('lib')): + if not pkg_util.install_package(req, target=hass.config.path('deps')): _LOGGER.error('Not initializing %s because could not install ' 'dependency %s', name, req) return False @@ -211,7 +211,7 @@ def prepare_setup_platform(hass, config, domain, platform_name): def mount_local_lib_path(config_dir): """Add local library to Python Path.""" - sys.path.insert(0, os.path.join(config_dir, 'lib')) + sys.path.insert(0, os.path.join(config_dir, 'deps')) # pylint: disable=too-many-branches, too-many-statements, too-many-arguments @@ -372,10 +372,16 @@ def process_ha_config_upgrade(hass): _LOGGER.info('Upgrading config directory from %s to %s', conf_version, __version__) + # This was where dependencies were installed before v0.18 + # Probably should keep this around until ~v0.20. lib_path = hass.config.path('lib') if os.path.isdir(lib_path): shutil.rmtree(lib_path) + lib_path = hass.config.path('deps') + if os.path.isdir(lib_path): + shutil.rmtree(lib_path) + with open(version_path, 'wt') as outp: outp.write(__version__) diff --git a/tests/test_bootstrap.py b/tests/test_bootstrap.py index d38c3968533047acddc5818a502990201733401a..152818d02e4709a936a7c5100cfd6074f6b6757f 100644 --- a/tests/test_bootstrap.py +++ b/tests/test_bootstrap.py @@ -58,7 +58,7 @@ class TestBootstrap: """Test removal of library on upgrade.""" with tempfile.TemporaryDirectory() as config_dir: version_path = os.path.join(config_dir, '.HA_VERSION') - lib_dir = os.path.join(config_dir, 'lib') + lib_dir = os.path.join(config_dir, 'deps') check_file = os.path.join(lib_dir, 'check') with open(version_path, 'wt') as outp: @@ -79,7 +79,7 @@ class TestBootstrap: """Test removal of library with no upgrade.""" with tempfile.TemporaryDirectory() as config_dir: version_path = os.path.join(config_dir, '.HA_VERSION') - lib_dir = os.path.join(config_dir, 'lib') + lib_dir = os.path.join(config_dir, 'deps') check_file = os.path.join(lib_dir, 'check') with open(version_path, 'wt') as outp: diff --git a/tests/util/test_package.py b/tests/util/test_package.py index 840fe3d0ff81ff2d4ea4fadb405ab8cedd70607f..ea9a8f23dfae715d90cb77175ebf0e3a3ed27542 100644 --- a/tests/util/test_package.py +++ b/tests/util/test_package.py @@ -21,7 +21,7 @@ class TestPackageUtil(unittest.TestCase): def setUp(self): """Create local library for testing.""" self.tmp_dir = tempfile.TemporaryDirectory() - self.lib_dir = os.path.join(self.tmp_dir.name, 'lib') + self.lib_dir = os.path.join(self.tmp_dir.name, 'deps') def tearDown(self): """Stop everything that was started."""