Skip to content

Commit

Permalink
Added pkg-build-defs feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
solevis committed Mar 12, 2013
1 parent c25a8ea commit 7721211
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pykgin/pykgin.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,35 @@ def pkg_content(self, package):

return output_list[2::]

def pkg_build_defs(self, package):
"""Show remote package's build definitions."""
# execute pkgin
popen = Popen([self.pkgin_bin, "pkg-build-defs", package], stdout=PIPE, stderr=PIPE)
# retrieve output streams
(stdoutdata, stderrdata) = popen.communicate()
# if pkgin error
if(stderrdata):
# remove the line feed
error = stderrdata[0:-1]
raise PykginError(error)

# retrieve output
output = stdoutdata
# create a list which contain each packages
output_raw_list = output.split('\n')
# extract and sort each infos
output_list = {}
for element in output_raw_list[2:-1]:
# separate name and value
raw = element.split("=")
# add infos in the dict
try:
output_list[raw[0]].append(raw[1])
except KeyError:
output_list[raw[0]] = [raw[1]]

return output_list

if __name__ == "__main__":
print __doc__

Expand Down

0 comments on commit 7721211

Please sign in to comment.