1
mirror of https://github.com/home-assistant/core synced 2024-07-30 21:18:57 +02:00

Fix Mac OS install script (#2691)

This commit is contained in:
Paulus Schoutsen 2016-07-31 20:58:39 -07:00 committed by GitHub
parent 483b0045fc
commit 6f23869a89
3 changed files with 10 additions and 4 deletions

View File

@ -5,8 +5,15 @@ import os
def run(args: str) -> int:
"""Run a script."""
scripts = [fil[:-3] for fil in os.listdir(os.path.dirname(__file__))
if fil.endswith('.py') and fil != '__init__.py']
scripts = []
path = os.path.dirname(__file__)
for fil in os.listdir(path):
if fil == '__pycache__':
continue
elif os.path.isdir(os.path.join(path, fil)):
scripts.append(fil)
elif fil != '__init__.py' and fil.endswith('.py'):
scripts.append(fil[:-3])
if not args:
print('Please specify a script to run.')

View File

@ -11,8 +11,7 @@ def install_osx():
with os.popen('whoami') as inp:
user = inp.read().strip()
cwd = os.path.dirname(__file__)
template_path = os.path.join(cwd, 'startup', 'launchd.plist')
template_path = os.path.join(os.path.dirname(__file__), 'launchd.plist')
with open(template_path, 'r', encoding='utf-8') as inp:
plist = inp.read()