Ticket #5348: sage-combinat.patch

File sage-combinat.patch, 2.5 KB (added by nthiery, 13 years ago)
  • sage-combinat

    diff -r 43d560970666 sage-combinat
    a b  
    6767                  metavar="http://sage.math.washington.edu:2144",
    6868                  default="http://sage.math.washington.edu:2144", type="string")
    6969
     70parser.add_option("-n", dest="n", action="store_true",
     71                  help="After qselect: disable all previous non version guards")
     72
    7073(options, args) = parser.parse_args()
    7174
    7275##############################################################################
     
    184187            info("Use option --force to proceed anyway")
    185188            exit(1)
    186189
    187 def qselect_backward_compatibility_patches():
    188     global sage_version
     190def qselect_backward_compatibility_patches(guards):
     191    global sage_version, options
    189192    r"""
    190193    Selects the appropriate guards for this version of sage
    191194    e.g. if we are running sage 3.0.2, then we want to apply all
     
    194197
    195198    # FIXME: how to change the guards on a one by one basis
    196199
    197     active_non_version_guards = filter(lambda guard: re.match("^(sage_)?(\d+_)*(\d+)$", guard) is None, hg_active_guards())
    198     info("Active guards: %s"%" ".join(active_non_version_guards))
     200    non_version_guards = filter(lambda guard: re.match("^(sage_)?(\d+_)*(\d+)$", guard) is None, hg_active_guards())
     201    info("Current non version guards: %s"%" ".join(non_version_guards))
    199202   
     203    if options.n:
     204        non_version_guards = []
     205
     206    non_version_guards = non_version_guards + guards
     207
     208    info("Updated non version guards: %s"%" ".join(non_version_guards))
     209
    200210    sage_version_as_list = [int(s) for s in re.split("\.", sage_version)]
    201211    def is_newversion_guard(guard):
    202212        """
     
    213223            info("Skip backward compatibility patches for sage "+re.sub("_",".",guard))
    214224            return False
    215225
    216     newversion_guards = map(lambda guard: guard[1:], # get rid of leading "+"
     226    version_guards = map(lambda guard: guard[1:], # get rid of leading "+"
    217227                            filter(is_newversion_guard, hg_all_guards()))
    218228
    219229    info("Updating guards")
    220230    system(hg+" qselect -q -n")
    221231    system(hg+" qselect "+
    222            " ".join(active_non_version_guards +
    223                     newversion_guards))
     232           " ".join(non_version_guards + version_guards))
    224233
    225234def update(update_from_sage_main = False):
    226235    r"""
     
    346355    info(hg_qstatus())
    347356
    348357elif args[0] == "qselect":
    349     qselect_backward_compatibility_patches()
     358    qselect_backward_compatibility_patches(args[1:])
    350359
    351360else:
    352361    error("unknown command "+args[0])