~launchpad/lp-dev-utils/packaging

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/python

import datetime
from lpscripts import LaunchpadAPIScript


class LicenseNotice(LaunchpadAPIScript):
    WHITEBOARD_MESSAGE = """\
%(owner_display_name)s (%(owner_name)s) notified by email of licensing problems on %(today)s. --%(me)s"""

    SUBJECT = "Licensing for your project in Launchpad (%(project_name)s)"

    MSG_TEMPLATE = u"""\
Hello %(owner_name)s,

You registered the project '%(project_name)s' in Launchpad. I Have disabled
the project.

The project's does not have a license specified. It is not clear that
the project qualifies for free hosting. If you want to specificy a
license to reactivated your project, ask at a question at
https://answers.launchpad.net/launchpad

Launchpad is a collaboration site that is free to use for projects
with an approved open source license.  When you registered your
project the list of licenses presented are the ones we automatically
recognize.

Other licenses must follow the guidelines we list on the following
page in order to be approved:
https://help.launchpad.net/Legal/ProjectLicensing

Further information is on our FAQ "Can closed-source or proprietary
projects use Launchpad?" which can be found at:
https://answers.launchpad.net/launchpad/+faq/208

Proprietary projects can use Launchpad by purchasing a commercial-use
subscription which costs US$250/year/project.  Please follow the
instructions presented on your project overview page to purchase a
subscription voucher.  Feel free to contact me if you have any
questions.

Thanks,

%(me)s
Canonical, Ltd.
"""
    USAGE="""\
%prog [options] [projects]

'projects' is a list of project names or URLs to projects in
Launchpad.  These projects will be notified of our licensing
policies.
"""

    def process_project(self, proj):
        """See `LaunchpadAPIScript`."""
        licenses = proj.licenses

        if proj.owner.name == self.REGISTRY_TEAM:
            print "Project owner is the registry team, skipping."
            return

        if proj.active:
            owner = proj.owner
            if owner.is_team:
                owner = owner.team_owner
            proj.project_reviewed = True
            proj.license_approved = False
            proj.active = False
            proj.lp_save()
            self.send_email(proj, owner)
            self.update_whiteboard(proj, owner)
        else:
            print "is already disabled, skipping."


if __name__ == "__main__":

    script = LicenseNotice()
    script.run()