lib/
share/
doc/_build/*
+win32/*.bat
+win32/meta.py
author_email = 'info@openerp.com'
license = 'AGPL-3'
+nt_service_name = "openerp-server-" + serie
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# based on http://mail.python.org/pipermail/python-win32/2007-June/006174.html
_TH32CS_SNAPPROCESS = 0x00000002
class _PROCESSENTRY32(ctypes.Structure):
- _fields_ = [("dwSize", ctypes.c_ulong),
- ("cntUsage", ctypes.c_ulong),
- ("th32ProcessID", ctypes.c_ulong),
- ("th32DefaultHeapID", ctypes.c_ulong),
- ("th32ModuleID", ctypes.c_ulong),
- ("cntThreads", ctypes.c_ulong),
- ("th32ParentProcessID", ctypes.c_ulong),
- ("pcPriClassBase", ctypes.c_ulong),
- ("dwFlags", ctypes.c_ulong),
- ("szExeFile", ctypes.c_char * 260)]
+ _fields_ = [("dwSize", ctypes.c_ulong),
+ ("cntUsage", ctypes.c_ulong),
+ ("th32ProcessID", ctypes.c_ulong),
+ ("th32DefaultHeapID", ctypes.c_ulong),
+ ("th32ModuleID", ctypes.c_ulong),
+ ("cntThreads", ctypes.c_ulong),
+ ("th32ParentProcessID", ctypes.c_ulong),
+ ("pcPriClassBase", ctypes.c_ulong),
+ ("dwFlags", ctypes.c_ulong),
+ ("szExeFile", ctypes.c_char * 260)]
def getppid():
CreateToolhelp32Snapshot = ctypes.windll.kernel32.CreateToolhelp32Snapshot
CloseHandle(hProcessSnap)
from contextlib import contextmanager
- from openerp.release import serie
+ from openerp.release import nt_service_name
def is_running_as_nt_service():
@contextmanager
finally:
ws.CloseServiceHandle(srv)
- service_name = 'openerp-server-' + serie
-
with close_srv(ws.OpenSCManager(None, None, ws.SC_MANAGER_ALL_ACCESS)) as hscm:
- with close_srv(ws.SmartOpenService(hscm, service_name, ws.SERVICE_ALL_ACCESS)) as hs:
+ with close_srv(ws.SmartOpenService(hscm, nt_service_name, ws.SERVICE_ALL_ACCESS)) as hs:
info = ws.QueryServiceStatusEx(hs)
return info.ProcessId == getppid()
import subprocess
import os
-from ..openerp.release import serie
+try:
+ import meta
+except ImportError:
+ if hasattr(sys, 'frozen'):
+ raise
+ from setup import generate_files
+ generate_files()
+ import meta
class OpenERPServerService(win32serviceutil.ServiceFramework):
# required info
- _svc_name_ = "openerp-server-" + serie
- _svc_display_name_ = "OpenERP Server " + serie
- # optionnal info
- _svc_description_ = "OpenERP Server %s service" % (serie,)
+ _svc_name_ = meta.nt_service_name
+ _svc_display_name_ = "%s %s" % (meta.description, meta.serie)
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from distutils.core import setup
+import os
import py2exe
+meta = {}
+execfile(os.path.join(os.path.dirname(__file__), '..', 'openerp', 'release.py'), meta)
+
+def generate_files():
+ actions = {
+ 'start': ['stop', 'start'],
+ 'stop': ['stop'],
+ }
+
+ files = []
+ for action, steps in actions.items():
+ fname = action + '.bat'
+ files.append(fname)
+ with open(fname, 'w') as fp:
+ fp.write('@PATH=%WINDIR%\system32;%WINDIR%;%WINDIR%\System32\Wbem;.')
+ for step in steps:
+ fp.write('@net %s %s' % (step, meta['nt_service_name']))
+
+ files.append('meta.py')
+ with open('meta.py', 'w') as fp:
+ for m in 'description serie nt_service_name'.split():
+ fp.write("%s = %r" % (m, meta[m],))
-setup(service=["OpenERPServerService"],
- options={"py2exe":{"excludes":["Tkconstants","Tkinter","tcl",
- "_imagingtk","PIL._imagingtk",
- "ImageTk", "PIL.ImageTk",
- "FixTk"],
- "skip_archive": 1,
- "optimize": 2,}}
+ return files
+
+excludes = "Tkconstants Tkinter tcl _imagingtk PIL._imagingtk ImageTk PIL.ImageTk FixTk".split()
+
+setup(service = ["OpenERPServerService"],
+ version = meta['version'],
+ licence = meta['licence'],
+ url = meta['url'],
+ author = meta['author'],
+ author_email = meta['author_email'],
+ data_files = generate_files(),
+ options = {"py2exe": {
+ "excludes": excludes,
+ "skip_archive": 1,
+ "optimize": 2,
+ }}
)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+++ /dev/null
-@PATH=%WINDIR%\system32;%WINDIR%;%WINDIR%\System32\Wbem;.\r
-\r
-@net stop openerp-server-6.1\r
-\r
-@net start openerp-server-6.1\r
-\r
-cls\r
+++ /dev/null
-@PATH=%WINDIR%\system32;%WINDIR%;%WINDIR%\System32\Wbem;.\r
-\r
-@net stop openerp-server-6.1\r
-\r
-cls\r