source: admin/Sources/Clients/ogagent/src/setup.py @ 3cc5bd2

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 3cc5bd2 was 82bc070, checked in by ramon <ramongomez@…>, 8 years ago

#718: Permitir caracteres Unicode y mensajes de varias líneas en OGAgent para Windows.

git-svn-id: https://opengnsys.es/svn/branches/version1.1@5481 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100644
File size: 4.8 KB
Line 
1# -*- coding: utf-8 -*-
2#
3# Copyright (c) 2014 Virtual Cable S.L.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without modification,
7# are permitted provided that the following conditions are met:
8#
9#    * Redistributions of source code must retain the above copyright notice,
10#      this list of conditions and the following disclaimer.
11#    * Redistributions in binary form must reproduce the above copyright notice,
12#      this list of conditions and the following disclaimer in the documentation
13#      and/or other materials provided with the distribution.
14#    * Neither the name of Virtual Cable S.L. nor the names of its contributors
15#      may be used to endorse or promote products derived from this software
16#      without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29'''
30@author: Adolfo Gómez, dkmaster at dkmon dot com
31@author: Ramón M. Gómez, ramongomez at us dot es
32'''
33
34VERSION = '1.1.0'
35
36# ModuleFinder can't handle runtime changes to __path__, but win32com uses them
37try:
38    # py2exe 0.6.4 introduced a replacement modulefinder.
39    # This means we have to add package paths there, not to the built-in
40    # one.  If this new modulefinder gets integrated into Python, then
41    # we might be able to revert this some day.
42    # if this doesn't work, try import modulefinder
43    try:
44        import py2exe.mf as modulefinder
45    except ImportError:
46        import modulefinder
47    import win32com, sys
48    for p in win32com.__path__[1:]:
49        modulefinder.AddPackagePath("win32com", p)
50    for extra in ["win32com.shell"]:  # ,"win32com.mapi"
51        __import__(extra)
52        m = sys.modules[extra]
53        for p in m.__path__[1:]:
54            modulefinder.AddPackagePath(extra, p)
55except ImportError:
56    # no build path setup, no worries.
57    pass
58
59from distutils.core import setup
60import py2exe
61import sys
62import os
63
64sys.argv.append('py2exe')
65
66def get_requests_cert_file():
67    """Add Python requests or certifi .pem file for installers."""
68    import requests
69    f = os.path.join(os.path.dirname(requests.__file__), 'cacert.pem')
70    if not os.path.exists(f):
71        import certifi
72        f = os.path.join(os.path.dirname(certifi.__file__), 'cacert.pem')
73    return f
74
75
76class Target:
77
78    def __init__(self, **kw):
79        self.__dict__.update(kw)
80        # for the versioninfo resources
81        self.version = VERSION
82        self.name = 'OGAgentService'
83        self.description = 'OpenGnsys Agent Service'
84        self.author = 'Adolfo Gomez'
85        self.url = 'https://opengnsys.es/'
86        self.company_name = "OpenGnsys Project"
87        self.copyright = "(c) 2014 VirtualCable S.L.U."
88        self.name = "OpenGnsys Agent"
89
90# Now you need to pass arguments to setup
91# windows is a list of scripts that have their own UI and
92# thus don't need to run in a console.
93
94
95udsservice = Target(
96    description='OpenGnsys Agent Service',
97    modules=['opengnsys.windows.OGAgentService'],
98    icon_resources=[(0, 'img\\oga.ico'), (1, 'img\\oga.ico')],
99    cmdline_style='pywin32'
100)
101
102# Some test_modules are hidden to py2exe by six, we ensure that they appear on "includes"
103HIDDEN_BY_SIX = ['SocketServer', 'SimpleHTTPServer', 'urllib']
104
105setup(
106    windows=[
107        {
108            'script': 'OGAgentUser.py',
109            'icon_resources': [(0, 'img\\oga.ico'), (1, 'img\\oga.ico')]
110        },
111    ],
112    console=[
113        {
114            'script': 'OGAServiceHelper.py'
115        }
116    ],
117    service=[udsservice],
118    data_files=[('', [get_requests_cert_file()]),('cfg', ['cfg/ogagent.cfg', 'cfg/ogclient.cfg'])],
119    options={
120        'py2exe': {
121            'bundle_files': 3,
122            'compressed': True,
123            'optimize': 2,
124            'includes': ['sip', 'PyQt4', 'win32com.shell', 'requests', 'encodings', 'encodings.utf_8'] + HIDDEN_BY_SIX,
125            'excludes': ['doctest', 'unittest'],
126            'dll_excludes': ['msvcp90.dll'],
127            'dist_dir': '..\\bin',
128        }
129    },
130    name='OpenGnsys Agent',
131    version=VERSION,
132    description='OpenGnsys Agent',
133    author='Adolfo Gomez',
134    author_email='agomez@virtualcable.es',
135    zipfile='OGAgent.zip',
136)
Note: See TracBrowser for help on using the repository browser.