Skip to content

Commit

Permalink
Make distro dependency optional
Browse files Browse the repository at this point in the history
The distro package only supports Linux, and it is only used
here to detect Ubuntu.  Make it an optional dependency in the
code, so that packagers can exclude it when it isnt needed.

Closes ofek#15
  • Loading branch information
jayvdb committed Oct 15, 2019
1 parent bfe4e88 commit 484cae0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions userpath/shells.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from os import path, pathsep

import distro
try:
import distro
except ImportError:
distro = None

DEFAULT_SHELLS = ('bash', 'sh')

Expand Down Expand Up @@ -34,7 +37,7 @@ def config(self, location, front=True):
configs = {path.join(self.home, '.bashrc'): contents}

# https://github.com/ofek/userpath/issues/3#issuecomment-492491977
if distro.id() == 'ubuntu':
if distro and distro.id() == 'ubuntu':
login_config = path.join(self.home, '.profile')
else:
# NOTE: If it is decided in future that we want to make a distinction between
Expand Down

0 comments on commit 484cae0

Please sign in to comment.