Example #1
0
# This may not be the best way to retrieve the username, but we are asking
# the user anyway, therefore it shouldn't matter too much...
username = getpass.getuser()


def comment(text):
    return "\n".join(["# %s" % line for line in text.splitlines()])


#=============================================================================
# Create the Plan object: we need to add all the possible choices a user may
# want to make and the code to use for each choice.
plan = ChoiceList("I'm now going to ask a few questions in order to build a "
                  "plan for making the distribution (a plan is just a shell "
                  "script that you can run to re-create the distribution so "
                  "that you don't need to answer the same questions again "
                  "and again).")

use_def_un = plan.add_choice(
    Choice("Which username should I use to access "
           "the repositories?"))
use_def_un.add_alternative(Alternative("Use '%s'." % username))
use_def_un.add_alternative(Alternative("Use a different username."))

what_un = plan.add_choice(OpenQuestion("What username shoud I use?"))
what_un.when_should_ask(lambda: use_def_un.chosen == 1)

want_ctr = plan.add_choice(
    Choice("Which repositories do you want to use as "
           "source for building the tarball?"))
Example #2
0
        kind = kind.lower().strip()
        if kind == "patch":
            return Version(self.major, self.minor, self.patch + 1)
        elif kind == "minor":
            return Version(self.major, self.minor + 1, 0)
        elif kind == "major":
            return Version(self.major + 1, 0, 0)
        else:
            raise ValueError("Unknown kind in method Version.next")

current = version.version
v = Version(current[0], current[1], current[2])

#=============================================================================
plan = ChoiceList("I'm now going to ask a few questions in order to collect "
                  "enough information for the release. You can quit any time "
                  "with CTRL+C. I will give you an opportunity to review "
                  "the operation after I collected all the information.")

remind1 = plan.add_choice(Choice("Have you updated the changelog?"))
remind1.add_alternative(Alternative("Yes"))
remind1.add_alternative(Alternative("No"))

rel_kind = plan.add_choice(Choice("What kind of release do you want to make?"))
rel_kind.add_alternative(Alternative("Patch:  %s --> %s (just bugfixes)"
                                     % (v, v.next("patch"))))
rel_kind.add_alternative(Alternative("Minor:  %s --> %s (improvements without "
                                     "radical interface changes)"
                                     % (v, v.next("minor"))))
rel_kind.add_alternative(Alternative("Major:  %s --> %s (improvements with "
                                     "radical interface changes)"
                                     % (v, v.next("major"))))
Example #3
0
version = "distmake-builder 0.1"

# This may not be the best way to retrieve the username, but we are asking
# the user anyway, therefore it shouldn't matter too much...
username = getpass.getuser()

def comment(text):
    return "\n".join(["# %s" % line for line in text.splitlines()])

#=============================================================================
# Create the Plan object: we need to add all the possible choices a user may
# want to make and the code to use for each choice.
plan = ChoiceList("I'm now going to ask a few questions in order to build a "
                  "plan for making the distribution (a plan is just a shell "
                  "script that you can run to re-create the distribution so "
                  "that you don't need to answer the same questions again "
                  "and again).")

use_def_un = plan.add_choice(Choice("Which username should I use to access "
                                    "the repositories?"))
use_def_un.add_alternative(Alternative("Use '%s'." % username))
use_def_un.add_alternative(Alternative("Use a different username."))

what_un = plan.add_choice(OpenQuestion("What username shoud I use?"))
what_un.when_should_ask(lambda: use_def_un.chosen == 1)

want_ctr = plan.add_choice(Choice("Which repositories do you want to use as "
                                  "source for building the tarball?"))
want_ctr.add_alternative(Alternative("Use the central repositories."))
want_ctr.add_alternative(Alternative("Use the current repository for src and "