Is there any way without running:
sudo apt-add-repository [PPA]
That you can get the description (and possibly some other additional information) of a PPA through Terminal?
A quick hack (needs package python3-launchpadlib
):
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys,re
from launchpadlib.launchpad import Launchpad
import httplib2
import lazr.restfulclient.errors
if len(sys.argv) < 2:
print('Syntax: {cmd} ppa'.format(cmd=sys.argv[0]))
print()
print('For example: {cmd} ppa://diesch/testing'.format(cmd=sys.argv[0]))
sys.exit(2)
try:
lp = Launchpad.login_anonymously('foo', 'production', None)
except httplib2.HttpLib2Error as e:
print('Error connection to launchpad.net:', e)
sys.exit(1)
ppa_name = sys.argv[1].strip()
m = re.search(r'^(ppa:)?(?P<user>[^/]+)/(?P<name>.+)', ppa_name)
if m:
user, name = m.group('user', 'name')
else:
print('Unvalid PPA name:', ppa)
sys.exit(1)
try:
owner = lp.people[user]
ppa = owner.getPPAByName(name=name)
print('PPA {name} at {url}'.format(name=ppa_name, url=ppa.web_link))
print()
print('Owner: {owner} ({url})'.format(owner=owner.display_name,
url=owner.web_link))
print()
print(ppa.description)
except lazr.restfulclient.errors.RestfulError as e:
print('Error getting PPA info:', e)
exit(1)
Save this as e.g. ppa-info
, make it executable and run it like
ppa-info ppa:diesch/testing
If the PPA exists, you will get some information, like owner and description, otherwise you'll get an error message.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments