Skip to content

Commit

Permalink
fix: remove unsed render code & import pip
Browse files Browse the repository at this point in the history
this fails for users that don't have `pip` installed in the env, but
this code is not used anyhow
  • Loading branch information
michael-go committed Dec 18, 2018
1 parent 5a98a79 commit 05c4e33
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 43 deletions.
19 changes: 0 additions & 19 deletions plug/distPackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,6 @@ def __init__(self, obj, req=None):
self.version_spec = None
self.req = req

def render_as_root(self, frozen):
if not frozen:
return '{0}=={1}'.format(self.project_name, self.version)
else:
return self.__class__.frozen_repr(self._obj)

def render_as_branch(self, frozen):
assert self.req is not None
if not frozen:
parent_ver_spec = self.req.version_spec
parent_str = self.req.project_name
if parent_ver_spec:
parent_str += parent_ver_spec
return (
'{0}=={1} [requires: {2}]'
).format(self.project_name, self.version, parent_str)
else:
return self.render_as_root(frozen)

def as_requirement(self):
"""Return a ReqPackage representation of this DistPackage"""
return ReqPackage(self._obj.as_requirement(), dist=self)
Expand Down
7 changes: 0 additions & 7 deletions plug/package.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pip


class Package(object):
"""Abstract class for wrappers around objects that pip returns.
Expand All @@ -24,11 +22,6 @@ def render(self, parent=None, frozen=False):
else:
return self.render_as_branch(frozen)

@staticmethod
def frozen_repr(obj):
fr = pip.FrozenRequirement.from_dist(obj, [])
return str(fr).strip()

def __getattr__(self, key):
return getattr(self._obj, key)

Expand Down
17 changes: 0 additions & 17 deletions plug/reqPackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,6 @@ def is_conflicting(self):
req_obj = pkg_resources.Requirement.parse(req_version_str)
return self.installed_version not in req_obj

def render_as_root(self, frozen):
if not frozen:
return '{0}=={1}'.format(self.project_name, self.installed_version)
elif self.dist:
return self.__class__.frozen_repr(self.dist._obj)
else:
return self.project_name

def render_as_branch(self, frozen):
if not frozen:
req_ver = self.version_spec if self.version_spec else 'Any'
return (
'{0} [required: {1}, installed: {2}]'
).format(self.project_name, req_ver, self.installed_version)
else:
return self.render_as_root(frozen)

def as_dict(self):
return {'key': self.key,
'package_name': self.project_name,
Expand Down

0 comments on commit 05c4e33

Please sign in to comment.