#!/usr/bin/env python
# Handles NEW and BYHAND packages
-# Copyright (C) 2001, 2002, 2003 James Troup <james@nocrew.org>
-# $Id: lisa,v 1.27 2004-01-29 23:18:47 dsilvers Exp $
+# Copyright (C) 2001, 2002, 2003, 2004 James Troup <james@nocrew.org>
+# $Id: lisa,v 1.30 2004-04-01 17:13:11 troup Exp $
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
################################################################################
-import copy, errno, os, readline, stat, sys, tempfile;
+import copy, errno, os, readline, stat, sys;
import apt_pkg, apt_inst;
import db_access, fernanda, katie, logging, utils;
# Globals
-lisa_version = "$Revision: 1.27 $";
+lisa_version = "$Revision: 1.30 $";
Cnf = None;
Options = None;
def edit_new (new):
# Write the current data to a temporary file
- temp_filename = tempfile.mktemp();
- fd = os.open(temp_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0700);
- os.close(fd);
+ temp_filename = utils.temp_filename();
temp_file = utils.open_file(temp_filename, 'w');
print_new (new, 0, temp_file);
temp_file.close();
got_priority = 0;
while not got_priority:
new_priority = utils.our_raw_input("New priority: ").strip();
- if Priorities.priorities.count(new_priority) == 0:
+ if new_priority not in Priorities.priorities:
print "E: '%s' is not a valid priority, try again." % (new_priority);
else:
got_priority = 1;
got_section = 0;
while not got_section:
new_section = utils.our_raw_input("New section: ").strip();
- if Sections.sections.count(new_section) == 0:
+ if new_section not in Sections.sections:
print "E: '%s' is not a valid section, try again." % (new_section);
else:
got_section = 1;
def edit_note(note):
# Write the current data to a temporary file
- temp_filename = tempfile.mktemp();
- fd = os.open(temp_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0700);
- os.close(fd);
+ temp_filename = utils.temp_filename();
temp_file = utils.open_file(temp_filename, 'w');
temp_file.write(note);
temp_file.close();
def prod_maintainer ():
# Here we prepare an editor and get them ready to prod...
- temp_filename = tempfile.mktemp();
- fd = os.open(temp_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0700);
- os.close(fd);
+ temp_filename = utils.temp_filename();
editor = os.environ.get("EDITOR","vi")
answer = 'E';
while answer == 'E':
answer = answer[:1].upper();
os.unlink(temp_filename);
if answer == 'A':
- return 1;
+ return;
elif answer == 'Q':
sys.exit(0);
# Otherwise, do the proding...
Cnf["Dinstall::MyAdminAddress"]);
Subst = Katie.Subst;
-
+
Subst["__FROM_ADDRESS__"] = user_email_address;
Subst["__PROD_MESSAGE__"] = prod_message;
Subst["__CC__"] = "Cc: " + Cnf["Dinstall::MyEmailAddress"];