~bzoltan/ubuntu-sdk-ide/fix_dependencies

« back to all changes in this revision

Viewing changes to getdsc.py

  • Committer: Benjamin Zeller
  • Date: 2016-01-12 11:49:24 UTC
  • mfrom: (101.1.2 ubuntu-sdk-ide)
  • Revision ID: benjamin.zeller@canonical.com-20160112114924-691j7dx0113mp4ta
Remove the -dev package from the IDE build

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
 
3
 
from optparse import OptionParser
4
 
import re
5
 
import urlparse
6
 
from launchpadlib.launchpad import Launchpad
7
 
 
8
 
def create_webroot_url_from_self_link(self_link):
9
 
    scheme, netloc, _, _, _ = urlparse.urlsplit(self_link)
10
 
    netloc = netloc.lstrip("api.")
11
 
    return u"%s://%s/" %(scheme, netloc)
12
 
    
13
 
def get_dsc(archive, package, series):
14
 
    re_version = re.compile(r"^\d+\:")
15
 
   # x = archive.getPublishedSources()
16
 
    x = archive.getPublishedSources(exact_match=True, source_name=package,
17
 
            distro_series=series)
18
 
    webroot = create_webroot_url_from_self_link(archive.self_link)
19
 
   # for i in x:
20
 
    version = x[0].source_package_version
21
 
    version = re_version.sub("", version, 1)
22
 
    #yield "%s~%s/+archive/primary/+files/%s_%s.dsc" \
23
 
    yield "%subuntu/+archive/primary/+files/%s_%s.dsc" \
24
 
         %(webroot, x[0].source_package_name, version)
25
 
         #%(webroot, archive.owner.name, x[0].source_package_name, version)
26
 
 
27
 
def main():
28
 
    parser = OptionParser(usage="usage: %prog [options] source ...")
29
 
    parser.add_option(
30
 
        "-l", "--launchpad", dest="launchpad_instance", default="production")
31
 
    options, args = parser.parse_args()
32
 
    if not args:
33
 
        parser.error("You must specify at least one soure.")
34
 
 
35
 
    options.launchpad = Launchpad.login_with(
36
 
        "branch-seeds", options.launchpad_instance)
37
 
 
38
 
    launchpad = Launchpad.login_anonymously('just testing', 'production')
39
 
    ubuntu = launchpad.distributions["ubuntu"]
40
 
    archive = ubuntu.main_archive
41
 
    series = ubuntu.getSeries(name_or_version="xenial")
42
 
 
43
 
    #distro = options.launchpad.distributions["ubuntu"]
44
 
 
45
 
    for package in args:
46
 
        #print(package)
47
 
        #print(series)
48
 
        #print(archive)
49
 
 
50
 
        re_version = re.compile(r"^\d+\:")
51
 
        x = archive.getPublishedSources(exact_match=True, source_name=package, distro_series=series)[0].source_package_version
52
 
 
53
 
        generator = get_dsc(archive, package, series)
54
 
        for i in generator:
55
 
            print(i)
56
 
 
57
 
main()