Skip to content

Remove dependencies and requirements#23024

Merged
balloob merged 9 commits intohome-assistant:devfrom
cgtobi:remove_requirements
Apr 12, 2019
Merged

Remove dependencies and requirements#23024
balloob merged 9 commits intohome-assistant:devfrom
cgtobi:remove_requirements

Conversation

@cgtobi
Copy link
Copy Markdown
Contributor

@cgtobi cgtobi commented Apr 11, 2019

Description:

Removes dependencies and requirements.

Related issue (if applicable): fixes #23016 fixes #23017

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>

Script:

#!/bin/bash

for i in $(find ./homeassistant/components -name '*.py'); do

  if [[ `grep -e '^REQUIREMENTS = \[' ${i}` ]]; then
    LOC=$(grep -n -e '^REQUIREMENTS = \[' ${i} | cut -f1 -d:)

    if [[ `grep -e '^REQUIREMENTS = \[.*\]$' ${i}` ]]; then
      sed -i -e '/^REQUIREMENTS = \[.*\]$/d' ${i}
    else
      sed -i -e '/^REQUIREMENTS/{:a;N;/\]$/!ba};/REQUIREMENTS = \[/d' ${i}
    fi
    if [[ `sed -n "${LOC}p" ${i}` == '' ]]; then
      sed -i -e "${LOC}d" ${i}
    fi
    echo REQUIREMENTS ${i}
  fi

  if [[ `grep -e '^DEPENDENCIES = \[' ${i}` ]]; then
    LOC=$(grep -n -e '^DEPENDENCIES = \[' ${i} | cut -f1 -d:)

    if [[ `grep -e '^DEPENDENCIES = \[.*\]$' ${i}` ]]; then
      sed -i -e '/^DEPENDENCIES = \[.*\]$/d' ${i}
    else
      sed -i -e '/^DEPENDENCIES/{:a;N;/\]$/!ba};/DEPENDENCIES = \[/d' ${i}
    fi
    if [[ `sed -n "${LOC}p" ${i}` == '' ]]; then
      sed -i -e "${LOC}d" ${i}
    fi
    echo DEPENDENCIES ${i}
  fi

done

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly (example).
  • New dependencies have been added to requirements in the manifest (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@ghost ghost assigned cgtobi Apr 11, 2019
@ghost ghost added the in progress label Apr 11, 2019
@balloob
Copy link
Copy Markdown
Member

balloob commented Apr 11, 2019

Could we remove the line, instead of replacing it with an empty line ?

@balloob
Copy link
Copy Markdown
Member

balloob commented Apr 11, 2019

Before you run your script, find all components that have multiline DEPS/REQS and make them a single line, so that the removal script removes them. There are not too many.

> git grep REQUIREMENTS | grep -v "]"
homeassistant/components/bh1750/sensor.py:12:REQUIREMENTS = ['i2csense==0.0.4',
homeassistant/components/bme280/sensor.py:16:REQUIREMENTS = ['i2csense==0.0.4',
homeassistant/components/bme680/sensor.py:16:REQUIREMENTS = ['bme680==1.0.5',
homeassistant/components/emulated_hue/__init__.py:11:from homeassistant.components.http import REQUIREMENTS  # NOQA
homeassistant/components/envirophat/sensor.py:14:REQUIREMENTS = ['envirophat==0.0.6',
homeassistant/components/google/__init__.py:16:REQUIREMENTS = [
homeassistant/components/htu21d/sensor.py:15:REQUIREMENTS = ['i2csense==0.0.4',
homeassistant/components/nuimo_controller/__init__.py:11:REQUIREMENTS = [
homeassistant/components/onvif/camera.py:23:REQUIREMENTS = ['onvif-py3==0.1.3',
homeassistant/components/sht31/sensor.py:19:REQUIREMENTS = ['Adafruit-GPIO==1.0.3',
homeassistant/components/tank_utility/sensor.py:15:REQUIREMENTS = [
homeassistant/components/zha/__init__.py:23:REQUIREMENTS = [
› git grep DEPENDENCIES | grep -v "]"
homeassistant/components/automation/webhook.py:14:DEPENDENCIES = ('webhook',)
homeassistant/components/cast/media_player.py:30:DEPENDENCIES = ('cast',)
homeassistant/components/frontend/__init__.py:27:DEPENDENCIES = ['api', 'websocket_api', 'http', 'system_log',
homeassistant/components/sonos/media_player.py:28:DEPENDENCIES = ('sonos',)
homeassistant/components/websocket_api/__init__.py:9:DEPENDENCIES = ('http',)

@awarecan
Copy link
Copy Markdown
Contributor

E303 too many blank lines (4)

@balloob balloob mentioned this pull request Apr 12, 2019
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove REQUIREMENTS from all integrations Remove DEPENDENCIES from all integration files

4 participants