~fginther/ppa-dev-tools/ppa_sync-fix-source-package-search

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/python

import re, os, sys
import time, datetime
from launchpadlib.launchpad import Launchpad, STAGING_SERVICE_ROOT
from launchpadlib.credentials import Credentials

from urllib2 import URLError, HTTPError
import httplib2
httplib2.debuglevel = 1

name = 'lpl-test'
home = os.path.expanduser('~')
cachedir = os.path.join(home, '.cache', name)
if not os.path.exists(cachedir):
    os.makedirs(cachedir,0700)

launchpad = Launchpad.login_with(
    name,
    service_root=STAGING_SERVICE_ROOT,
    launchpadlib_dir=cachedir,
    credentials_file="/tmp/test-creds")

ppa_name = "testing1234"
description = """This is a test
123"""

me = launchpad.me
team = launchpad.people[me.name]
results = team.createPPA(
    name=ppa_name,
    displayname=ppa_name,
    description=description)
team.lp_save()