fixed issue 1225, NEWINSTALL ignored

This commit is contained in:
mdipierro
2012-12-17 08:46:33 -06:00
parent c99d34aecc
commit 3dd857aa9f
3 changed files with 14 additions and 10 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.3.1 (2012-12-16 12:35:38) dev Version 2.3.1 (2012-12-17 08:45:52) dev
+10 -8
View File
@@ -15,6 +15,7 @@ import tarfile
import glob import glob
import time import time
import datetime import datetime
import logging
from http import HTTP from http import HTTP
from gzip import open as gzopen from gzip import open as gzopen
@@ -240,19 +241,20 @@ def w2p_pack(filename, path, compiled=False):
tarfp.close() tarfp.close()
os.unlink(tarname) os.unlink(tarname)
def create_welcome_w2p():
def w2p_unpack(filename, path, delete_tar=True): if not os.path.exists('welcome.w2p') or os.path.exists('NEWINSTALL'):
if filename=='welcome.w2p' and (
not os.path.exists('welcome.w2p') or \
os.path.exists('NEWINSTALL')):
try: try:
w2p_pack('welcome.w2p', 'applications/welcome') w2p_pack('welcome.w2p', 'applications/welcome')
os.unlink('NEWINSTALL') os.unlink('NEWINSTALL')
logging.info("New installation: created welcome.w2p file")
except: except:
msg = "New installation: unable to create welcome.w2p file" logging.error("New installation error: unable to create welcome.w2p file")
sys.stderr.write(msg)
def w2p_unpack(filename, path, delete_tar=True):
if filename=='welcome.w2p':
create_welcome_w2p()
filename = abspath(filename) filename = abspath(filename)
path = abspath(path) path = abspath(path)
if filename[-4:] == '.w2p' or filename[-3:] == '.gz': if filename[-4:] == '.w2p' or filename[-3:] == '.gz':
+3 -1
View File
@@ -25,7 +25,7 @@ import newcron
import getpass import getpass
import main import main
from fileutils import w2p_pack, read_file, write_file from fileutils import w2p_pack, read_file, write_file, create_welcome_w2p
from settings import global_settings from settings import global_settings
from shell import run, test from shell import run, test
from utils import is_valid_ip_address, is_loopback_ip_address from utils import is_valid_ip_address, is_loopback_ip_address
@@ -969,6 +969,8 @@ def console():
if options.numthreads is not None and options.minthreads is None: if options.numthreads is not None and options.minthreads is None:
options.minthreads = options.numthreads # legacy options.minthreads = options.numthreads # legacy
create_welcome_w2p()
if not options.cronjob: if not options.cronjob:
# If we have the applications package or if we should upgrade # If we have the applications package or if we should upgrade
if not os.path.exists('applications/__init__.py'): if not os.path.exists('applications/__init__.py'):