Is that really needed? I think just the following should work as well:
```python
for line in f:
    base_deps.append(line.split('\n')[0].split('#egg=')[1])
```