~openerp-groupes/openobject-server/6.0-fix-setup-windows

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: pinky
  • Date: 2006-12-07 13:41:40 UTC
  • Revision ID: pinky-3f10ee12cea3c4c75cef44ab04ad33ef47432907
New trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# -*- coding: utf-8 -*-
 
3
# setup from TinERP
 
4
#   taken from straw http://www.nongnu.org/straw/index.html
 
5
#   taken from gnomolicious http://www.nongnu.org/gnomolicious/
 
6
#   adapted by Nicolas Évrard <nicoe@altern.org>
 
7
#
 
8
# $Id$
 
9
 
 
10
import imp
 
11
import sys
 
12
import os
 
13
import glob
 
14
 
 
15
from distutils.core import setup, Command
 
16
from distutils.command.install_scripts import install_scripts
 
17
from distutils.file_util import copy_file
 
18
 
 
19
from stat import ST_MODE
 
20
 
 
21
opj = os.path.join
 
22
 
 
23
name = 'tinyerp-server'
 
24
version = '4.0.0'
 
25
 
 
26
# get python short version
 
27
py_short_version = '%s.%s' % sys.version_info[:2]
 
28
 
 
29
included_addons = [
 
30
    'account', 'account_followup', 'account_tax_include', 'airport', 'audittrail',
 
31
    'base','base_partner_relation', 'base_setup', 'crm', 'custom', 'delivery',
 
32
    'edi', 'esale_ez', 'esale_joomla', 'esale_osc',
 
33
    'hr', 'hr_evaluation', 'hr_expense', 'hr_skill', 'hr_timesheet',
 
34
    'hr_timesheet_ical', 'hr_timesheet_invoice', 'hr_timesheet_project',
 
35
    'letter', 'marketing', 'mrp', 'network', 'partner_ldap',
 
36
    'product','product_electronic', 'product_expiry', 'product_extended',
 
37
    'productivity_analysis', 'product_variant', 'profile_accounting',
 
38
    'profile_manufacturing', 'profile_service', 'project', 'purchase',
 
39
    'purchase_tax_include', 'report_analytic_line', 'report_crm',
 
40
    'report_project', 'report_purchase', 'report_sale', 'sale', 'sale_crm',
 
41
    'sale_journal', 'sale_rebate', 'sale_tax_include', 'sandwich', 'scrum',
 
42
    'stock', 'subscription', 'travel',
 
43
    'l10n_be', 'l10n_ca-qc', 'l10n_ch', 'l10n_ch_pcpbl_association',
 
44
    'l10n_ch_pcpbl_independant', 'l10n_ch_pcpbl_menage',
 
45
    'l10n_ch_pcpbl_plangen', 'l10n_ch_pcpbl_plangensimpl', 'l10n_ch_vat_brut',
 
46
    'l10n_ch_vat_forfait', 'l10n_ch_vat_net', 'l10n_fr', 'l10n_se',
 
47
    'l10n_simple', 'l10n_chart_at', 'l10n_chart_au', 'l10n_chart_be_frnl',
 
48
    'l10n_chart_br', 'l10n_chart_ca_en', 'l10n_chart_ca_fr',
 
49
    'l10n_chart_ch_german', 'l10n_chart_cn', 'l10n_chart_cn_traditional',
 
50
    'l10n_chart_co', 'l10n_chart_cz', 'l10n_chart_da', 'l10n_chart_de_skr03',
 
51
    'l10n_chart_hu', 'l10n_chart_id', 'l10n_chart_it', 'l10n_chart_it_cc2424',
 
52
    'l10n_chart_la', 'l10n_chart_nl', 'l10n_chart_nl_standard', 'l10n_chart_no',
 
53
    'l10n_chart_pa', 'l10n_chart_pl', 'l10n_chart_sp', 'l10n_chart_sw',
 
54
    'l10n_chart_sw_church', 'l10n_chart_sw_food', 'l10n_chart_uk',
 
55
    'l10n_chart_us_general', 'l10n_chart_us_manufacturing',
 
56
    'l10n_chart_us_service', 'l10n_chart_us_ucoa', 'l10n_chart_us_ucoa_ez',
 
57
    'l10n_chart_ve',]
 
58
 
 
59
required_modules = [('psycopg', 'PostgreSQL module'),
 
60
                    ('xml', 'XML Tools for python'),
 
61
                    ('libxml2', 'libxml2 python bindings'),
 
62
                    ('libxslt', 'libxslt python bindings')]
 
63
 
 
64
def check_modules():
 
65
    ok = True
 
66
    for modname, desc in required_modules:
 
67
        try:
 
68
            exec('import %s' % modname)
 
69
        except ImportError:
 
70
            ok = False
 
71
            print 'Error: python module %s (%s) is required' % (modname, desc)
 
72
 
 
73
    if not ok:
 
74
        sys.exit(1)
 
75
 
 
76
def find_addons():
 
77
    for addon in included_addons:
 
78
        path = opj('bin', 'addons', addon)
 
79
        for dirpath, dirnames, filenames in os.walk(path):
 
80
            if '__init__.py' in filenames:
 
81
                modname = dirpath.replace(os.path.sep, '.')
 
82
                yield modname.replace('bin', 'tinyerp-server', 1)
 
83
 
 
84
def data_files():
 
85
    '''Build list of data files to be installed'''
 
86
    files = [(opj('share', 'man', 'man1'),
 
87
              ['man/tinyerp-server.1']),
 
88
             (opj('share', 'man', 'man5'),
 
89
              ['man/terp_serverrc.5']),
 
90
             (opj('share','doc', 'tinyerp-server-%s' % version), 
 
91
              [f for f in glob.glob('doc/*') if os.path.isfile(f)]),
 
92
             (opj('lib','python%s' % py_short_version, 'site-package', 'tinyerp-server', 'i18n'), 
 
93
              glob.glob('bin/i18n/*')),
 
94
             (opj('lib', 'python%s' % py_short_version, 'site-packages', 'tinyerp-server', 'addons', 'custom'),
 
95
              glob.glob('bin/addons/custom/*xml') + 
 
96
              glob.glob('bin/addons/custom/*rml') +
 
97
              glob.glob('bin/addons/custom/*xsl'))]
 
98
    for addon in find_addons():
 
99
        add_path = addon.replace('.', os.path.sep).replace('tinyerp-server', 'bin',
 
100
                                                           1)
 
101
        pathfiles = [(opj('lib', 'python%s' % py_short_version, 'site-packages', 
 
102
                          add_path.replace('bin', 'tinyerp-server', 1)),
 
103
                      glob.glob(opj(add_path, '*xml')) +
 
104
                      glob.glob(opj(add_path, '*csv')) +
 
105
                      glob.glob(opj(add_path, '*sql'))),
 
106
                     (opj('lib', 'python%s' % py_short_version, 'site-packages',
 
107
                          add_path.replace('bin', 'tinyerp-server', 1), 'data'),
 
108
                      glob.glob(opj(add_path, 'data', '*xml'))), 
 
109
                     (opj('lib', 'python%s' % py_short_version, 'site-packages',
 
110
                          add_path.replace('bin', 'tinyerp-server', 1), 'report'),
 
111
                      glob.glob(opj(add_path, 'report', '*xml')) +
 
112
                      glob.glob(opj(add_path, 'report', '*rml')) +
 
113
                      glob.glob(opj(add_path, 'report', '*xsl')))]
 
114
        files.extend(pathfiles)
 
115
    return files
 
116
 
 
117
long_desc = '''\
 
118
Tiny ERP is a complete ERP and CRM. The main features are accounting (analytic
 
119
and financial), stock management, sales and purchases management, tasks
 
120
automation, marketing campaigns, help desk, POS, etc. Technical features include
 
121
a distributed server, flexible workflows, an object database, a dynamic GUI,
 
122
customizable reports, and SOAP and XML-RPC interfaces.
 
123
'''
 
124
 
 
125
classifiers = """\
 
126
Development Status :: 5 - Production/Stable
 
127
License :: OSI Approved :: GNU General Public License (GPL)
 
128
Programming Language :: Python
 
129
"""
 
130
 
 
131
check_modules()
 
132
 
 
133
# create startup script
 
134
start_script = \
 
135
"#!/bin/sh\n\
 
136
cd %s/lib/python%s/site-packages/tinyerp-server\n\
 
137
exec %s ./tinyerp-server.py $@" % (sys.prefix, py_short_version, sys.executable)
 
138
# write script
 
139
f = open('tinyerp-server', 'w')
 
140
f.write(start_script)
 
141
f.close()
 
142
 
 
143
setup(name             = name,
 
144
      version          = version,
 
145
      description      = "Tiny's Enterprise Resource Planning",
 
146
      long_description = long_desc,
 
147
      url              = 'http://tinyerp.com',
 
148
      author           = 'Tiny.be',
 
149
      author_email     = 'info@tiny.be',
 
150
      classifiers      = filter(None, classifiers.split("\n")),
 
151
      license          = 'GPL',
 
152
      data_files       = data_files(),
 
153
      packages         = ['tinyerp-server', 'tinyerp-server.addons',
 
154
                          'tinyerp-server.ir',
 
155
                          'tinyerp-server.osv',
 
156
                          'tinyerp-server.ssl',
 
157
                          'tinyerp-server.service', 'tinyerp-server.tools',
 
158
                          'tinyerp-server.pychart', 'tinyerp-server.pychart.afm',
 
159
                          'tinyerp-server.report',
 
160
                          'tinyerp-server.report.printscreen',
 
161
                          'tinyerp-server.report.render',
 
162
                          'tinyerp-server.report.render.rml2pdf',
 
163
                          'tinyerp-server.report.render.rml2html',
 
164
                          'tinyerp-server.wizard', 'tinyerp-server.workflow'] + \
 
165
                         list(find_addons()),
 
166
      package_dir      = {'tinyerp-server': 'bin'},
 
167
      scripts          = ['tinyerp-server']
 
168
      )
 
169
 
 
170
# vim:expandtab:tw=80