2 # -*- coding: utf-8 -*-
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>
15 from distutils.core import setup, Command
16 from distutils.command.install_scripts import install_scripts
17 from distutils.file_util import copy_file
19 from stat import ST_MODE
23 name = 'tinyerp-server'
26 # get python short version
27 py_short_version = '%s.%s' % sys.version_info[:2]
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',
59 required_modules = [('psycopg', 'PostgreSQL module'),
60 ('xml', 'XML Tools for python'),
61 ('libxml2', 'libxml2 python bindings'),
62 ('libxslt', 'libxslt python bindings')]
66 for modname, desc in required_modules:
68 exec('import %s' % modname)
71 print 'Error: python module %s (%s) is required' % (modname, desc)
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)
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('share','doc', 'tinyerp-server-%s' % version, 'migrate', '3.3.0-3.4.0'),
93 [f for f in glob.glob('doc/migrate/3.3.0-3.4.0/*') if os.path.isfile(f)]),
94 (opj('share','doc', 'tinyerp-server-%s' % version, 'migrate', '3.4.0-4.0.0'),
95 [f for f in glob.glob('doc/migrate/3.4.0-4.0.0/*') if os.path.isfile(f)]),
96 (opj('lib','python%s' % py_short_version, 'site-packagess', 'tinyerp-server', 'i18n'),
97 glob.glob('bin/i18n/*')),
98 (opj('lib', 'python%s' % py_short_version, 'site-packages', 'tinyerp-server', 'addons', 'custom'),
99 glob.glob('bin/addons/custom/*xml') +
100 glob.glob('bin/addons/custom/*rml') +
101 glob.glob('bin/addons/custom/*xsl'))]
102 for addon in find_addons():
103 add_path = addon.replace('.', os.path.sep).replace('tinyerp-server', 'bin',
105 pathfiles = [(opj('lib', 'python%s' % py_short_version, 'site-packages',
106 add_path.replace('bin', 'tinyerp-server', 1)),
107 glob.glob(opj(add_path, '*xml')) +
108 glob.glob(opj(add_path, '*csv')) +
109 glob.glob(opj(add_path, '*sql'))),
110 (opj('lib', 'python%s' % py_short_version, 'site-packages',
111 add_path.replace('bin', 'tinyerp-server', 1), 'data'),
112 glob.glob(opj(add_path, 'data', '*xml'))),
113 (opj('lib', 'python%s' % py_short_version, 'site-packages',
114 add_path.replace('bin', 'tinyerp-server', 1), 'report'),
115 glob.glob(opj(add_path, 'report', '*xml')) +
116 glob.glob(opj(add_path, 'report', '*rml')) +
117 glob.glob(opj(add_path, 'report', '*xsl')))]
118 files.extend(pathfiles)
122 Tiny ERP is a complete ERP and CRM. The main features are accounting (analytic
123 and financial), stock management, sales and purchases management, tasks
124 automation, marketing campaigns, help desk, POS, etc. Technical features include
125 a distributed server, flexible workflows, an object database, a dynamic GUI,
126 customizable reports, and SOAP and XML-RPC interfaces.
130 Development Status :: 5 - Production/Stable
131 License :: OSI Approved :: GNU General Public License (GPL)
132 Programming Language :: Python
137 # create startup script
140 cd %s/lib/python%s/site-packages/tinyerp-server\n\
141 exec %s ./tinyerp-server.py $@" % (sys.prefix, py_short_version, sys.executable)
143 f = open('tinyerp-server', 'w')
144 f.write(start_script)
149 description = "Tiny's Enterprise Resource Planning",
150 long_description = long_desc,
151 url = 'http://tinyerp.com',
153 author_email = 'info@tiny.be',
154 classifiers = filter(None, classifiers.split("\n")),
156 data_files = data_files(),
157 packages = ['tinyerp-server', 'tinyerp-server.addons',
159 'tinyerp-server.osv',
160 'tinyerp-server.ssl',
161 'tinyerp-server.service', 'tinyerp-server.tools',
162 'tinyerp-server.pychart', 'tinyerp-server.pychart.afm',
163 'tinyerp-server.report',
164 'tinyerp-server.report.printscreen',
165 'tinyerp-server.report.render',
166 'tinyerp-server.report.render.rml2pdf',
167 'tinyerp-server.report.render.rml2html',
168 'tinyerp-server.wizard', 'tinyerp-server.workflow'] + \
170 package_dir = {'tinyerp-server': 'bin'},
171 scripts = ['tinyerp-server']
174 # vim:expandtab:tw=80