~ubuntu-branches/ubuntu/natty/quickly/natty

« back to all changes in this revision

Viewing changes to data/templates/ubuntu-project/internal/packaging.py

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-03-29 19:00:48 UTC
  • mfrom: (8.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100329190048-olhobq492x3xnztz
Tags: 0.3.90-0ubuntu1
* New release:
  Quickly core:
  - check now that --template has one argument
  - -- enables to give options to templates (unknown options and arguments
    are still given to templates but -- specify explicity what to give to
    templates commands like -h, --version...)
  - check and enable recreation of the credential if user deletes it on
    Launchpad
  - Use realpath so that we can symlink to the binary in trunk.
    (Jonathan Lange)
  - project_path_not_found is raised when data_path_not_found should be
    (originated from Philip Peitsch's patch). (LP: #497688)
  - importing command in one template from another template is now possible
    support as well "all" keyword to import all commands from a template
    into another one (take care of overridden commands too)
    (LP: #452306, #487301)
  - add an apport hook to get installed templates (LP: #411127)
  - enable option completion for templates
  - handle now version upgrade, launching script for templates and handling
    versionning on them
  - change getstarted wording (LP: #486180) - Grant
  - Quickly ship now "version" tag instead of "format" tag
  - add some templatetools to check X display
  - if a commands exit with 4, do not show "ERROR:" (case of wrong command
    usage, for instance)
  - Rewrote importing module in both bin/quickly and ubuntu-project binary
  - Add get_camel_case_name() and get_sentence_name() to templatetools
  - Refactor some code in pre_create hook()
  - Now dashes and spaces support in project name! Dealing with python and
    packaging issues for you. (LP: #493130)
  - Provide Quickly API (LP: #426480)
  - Fix some issues in the man page
  ubuntu-application Template:
  - Enabling upload to team or user ppa, as well as any ppa.
    Use --ppa ppaname or --ppa team/ppaname
    .quickly file can be used as well with ppa = ppaname or
    ppa = team/ppaname (LP: #470192)
    ppa completion is also available
  - Change BSD header by full license
  - Add MIT license
  - Fixes an error when launchpad display name contains unicode character
    (Petar Vasić)
  - Fix typo in quickly help save (Petar Vasić)
  - Adds logo.png as logo property in about dialog (LP: #478389)
    (Petar Vasić)
  - Remove lp-project-change command and add configure command.
    configure lp-project [project_name] to set/reset lp project binded to
    your Quickly project
    ppa <ppa name> to set a default ppa with your project
  - Fix ~/.selected-editor being ignored (LP: #484730)
  - Fix wrong shell completion when in a template (it wrongly proposed
    all commands followed by templates)
  - Check if we have a X display available before running "run" or launching
    GUI in "create" command.
  - add -- support in quickly run to pass options like --help, --version so
    that Quickly core don't take them.
  - enable preferences save call being called multiple times (Philip Peitsch)
  - Use realpath so that we can symlink to the binary in trunk.
  - Fixed some errors in the tutorial (Brian) (LP: #499356)
  - Fix missing import sys in setup.py (Philip Peitsch) (LP: #499712)
  - rename ubuntu-project to ubuntu-application
  - enhance quickly license (no more Copyright file, only one AUTHORS file)
    personal license needs COPYING file now (and the header will be copied in
    every files). No more # needed in those files too. Some other little
    refactoring too (LP: #469330)
  - autolicence by default on first share/release (with LP info and on GPL-3)
  - change versionning support in ubuntu application: (LP: #476814)
   + quickly share just adds -publicX to current version where X is bumped
     at each "quicky share" execution
   + quickly release remove -publicX (if any) and release with current YY.MM.
     If there is already a release with that version, it will be YY.MM.1, 
     then YY.MM.2
  - add accelerators to menu items (jens persson)
  - set correctly title dialog (Philip Peitsch) (LP: #501999)
  - about dialog box is now fully automated: (LP: #478414)
   + update copyright, authors, license (when licensing)
   + version (when sharing and releasing)
   + homepage (when changing launchpad project: release and configure)
  - add an 'add' command. $ quickly dialog … is now $ quickly add dialog …
    (LP: #438320)
  - enable automatic release and milestone built in LP, releasing and pushing
    upstream tarball (LP: #470344)
  - automatic collect and publish changelog message from commits and save
    messages used during devlopment. (LP: #476572)
  - add i18n to boiler plate (LP: #423529)
  - enable adding manual depdencies to quickly project (LP: #474639)
  - enable configure its own bzr branch and resetting parent branch even once
    already configured (quickly configure bzr <branch-path>)
  - now recommends seahorse-plugins to have a graphical prompt for signing
    package
  - rename quickly glade to quickly design (LP: #528664)
  - create command is now more flexible and enable people to inherit from
    other template more easily
  - add translation domain to gtkbuilder and fix some items that shouldn't
    been translatable (Łukasz Jernaś)
  - add apport and launchpadintegration to new and existing project once
    bounded to LP (Philip Peitsch)
  - fix spelling mistake "connexion" (Łukasz Jernaś) (LP: #532667)
  - the ubuntu-application tutorial is now internationalized and use docbook
    format. Translators, it's yours! (Shane Fagan) (LP: #525168)
  - package/share/release are now more quiet and only print something on error
    warning as a summary as with unfound packages, and so on (LP: #482915)
  - new algorithm to select good email automatically. Try to get the preferred
    email and update the AUTHOR file with it.
  - test GPG key and create one automatically if none is available. The
    corresponding public key availabity in launchpad is also checked.
    (LP: #427730, #408993)
  - add devscripts as a dependency (bug #465833), will fix all the depends
    mess later
  - bump python-distutils-extra (>= 2.18bzr1)
  ubuntu-cli Template:
  - first release using import command feature (no command written into the
    template itself). This is a basic ubuntu CLI application
  ubuntu-pygame Template:
  - first release using import command feature. python-pygame added as a
    depends
* debian/control:
  - renamed and separate in multiple packages to get a -common used with
    Quickly widgets (LP: #519633)
  - suggests python-quickly-widgets

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
# Copyright 2009 Canonical Ltd.
3
 
# Author 2009 Didier Roche
4
 
#
5
 
# This file is part of Quickly ubuntu-project-template
6
 
#
7
 
#This program is free software: you can redistribute it and/or modify it 
8
 
#under the terms of the GNU General Public License version 3, as published 
9
 
#by the Free Software Foundation.
10
 
 
11
 
#This program is distributed in the hope that it will be useful, but 
12
 
#WITHOUT ANY WARRANTY; without even the implied warranties of 
13
 
#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
14
 
#PURPOSE.  See the GNU General Public License for more details.
15
 
 
16
 
#You should have received a copy of the GNU General Public License along 
17
 
#with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 
 
19
 
import re
20
 
import subprocess
21
 
import sys
22
 
 
23
 
 
24
 
from quickly import launchpadaccess
25
 
 
26
 
import gettext
27
 
from gettext import gettext as _
28
 
 
29
 
#set domain text
30
 
gettext.textdomain('quickly')
31
 
 
32
 
def updatepackaging():
33
 
    """create or update a package using python-mkdebian.
34
 
    
35
 
    Commit after the first packaging creation"""
36
 
    
37
 
    return_code = subprocess.call(["python-mkdebian"])
38
 
    if return_code == 0:
39
 
        print _("Ubuntu packaging created in debian/")
40
 
    else:
41
 
        print _("An error has occurred")
42
 
        return(return_code)
43
 
 
44
 
    # check if first python-mkdebian (debian/ creation) to commit it
45
 
    # that means debian/ under unknown
46
 
    bzr_instance = subprocess.Popen(["bzr", "status"], stdout=subprocess.PIPE)
47
 
    bzr_status, err = bzr_instance.communicate()
48
 
    if bzr_instance.returncode != 0:
49
 
        return(bzr_instance.returncode)
50
 
    
51
 
    if re.match('(.|\n)*unknown:\n.*debian/(.|\n)*', bzr_status):
52
 
        return_code = subprocess.call(["bzr", "add"])
53
 
        if return_code == 0:
54
 
            return_code = subprocess.call(["bzr", "commit", "-m 'Creating ubuntu package'"])
55
 
 
56
 
    return(return_code)
57
 
 
58
 
def push_to_ppa(ppa_user, changes_file):
59
 
    """ Push some code to a ppa """
60
 
    
61
 
    # creation/update debian packaging
62
 
    return_code = updatepackaging()
63
 
    if return_code != 0:
64
 
        print _("ERROR: can't create or update ubuntu package")
65
 
        return(return_code)
66
 
    
67
 
    # creating local binary package
68
 
    return_code = subprocess.call(["dpkg-buildpackage", "-S", "-I.bzr"])
69
 
    if return_code != 0:
70
 
        print _("ERROR: an error occurred during source package creation")
71
 
        return(return_code)
72
 
 
73
 
    if launchpadaccess.lp_server == "staging":
74
 
        ppa_targeted = "ppa:%s/%s" % (ppa_user, "staging")
75
 
    else:
76
 
        ppa_targeted = "ppa:%s/%s" % (ppa_user, "ppa")
77
 
 
78
 
    # now, pushing it to launchpad personal ppa (or team later)
79
 
    return_code = subprocess.call(["dput", ppa_targeted, changes_file])
80
 
    if return_code != 0:
81
 
        print _("ERROR: an error occurred during source upload to launchpad")
82
 
        return(return_code)
83
 
    
84
 
    return(0)
85
 
 
86
 
 
87
 
def check_for_ppa(launchpad, lp_team_or_user):
88
 
    """ check if ppa exist """
89
 
 
90
 
    # check that the owner really has an ppa:
91
 
    if launchpadaccess.lp_server == "staging":
92
 
        ppa_name_dest = 'staging'
93
 
    else:
94
 
        ppa_name_dest = 'ppa'
95
 
 
96
 
    ppa_found = False
97
 
    for ppa in lp_team_or_user.ppas:
98
 
        if ppa.name == ppa_name_dest:
99
 
            ppa_found = True
100
 
            break
101
 
 
102
 
    if not ppa_found:
103
 
        return(1)
104
 
 
105
 
    return(0)
106