2014-12-23 09:41:14 +01:00
|
|
|
#! /usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import glob
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import subprocess
|
2015-12-19 19:18:17 +01:00
|
|
|
import sys
|
2014-12-23 09:41:14 +01:00
|
|
|
|
2015-03-09 17:34:11 +01:00
|
|
|
from setuptools.command.install_lib import install_lib as _install_lib
|
|
|
|
from distutils.command.build import build as _build
|
2014-12-23 09:41:14 +01:00
|
|
|
from distutils.command.sdist import sdist
|
2015-03-09 17:34:11 +01:00
|
|
|
from distutils.cmd import Command
|
2018-01-26 12:23:07 +01:00
|
|
|
from distutils.spawn import find_executable
|
2014-12-23 09:41:14 +01:00
|
|
|
from setuptools import setup, find_packages
|
|
|
|
|
|
|
|
class eo_sdist(sdist):
|
|
|
|
def run(self):
|
|
|
|
if os.path.exists('VERSION'):
|
|
|
|
os.remove('VERSION')
|
|
|
|
version = get_version()
|
|
|
|
version_file = open('VERSION', 'w')
|
|
|
|
version_file.write(version)
|
|
|
|
version_file.close()
|
|
|
|
sdist.run(self)
|
|
|
|
if os.path.exists('VERSION'):
|
|
|
|
os.remove('VERSION')
|
|
|
|
|
|
|
|
def get_version():
|
|
|
|
if os.path.exists('VERSION'):
|
|
|
|
version_file = open('VERSION', 'r')
|
|
|
|
version = version_file.read()
|
|
|
|
version_file.close()
|
|
|
|
return version
|
|
|
|
if os.path.exists('.git'):
|
|
|
|
p = subprocess.Popen(['git', 'describe', '--dirty', '--match=v*'], stdout=subprocess.PIPE)
|
|
|
|
result = p.communicate()[0]
|
|
|
|
if p.returncode == 0:
|
|
|
|
version = result.split()[0][1:]
|
|
|
|
version = version.replace('-', '.')
|
|
|
|
return version
|
|
|
|
return '0'
|
|
|
|
|
2015-05-20 11:27:26 +02:00
|
|
|
def data_tree(destdir, sourcedir):
|
|
|
|
extensions = ['.css', '.png', '.jpeg', '.jpg', '.gif', '.xml', '.html', '.js']
|
|
|
|
r = []
|
|
|
|
for root, dirs, files in os.walk(sourcedir):
|
|
|
|
l = [os.path.join(root, x) for x in files if os.path.splitext(x)[1] in extensions]
|
|
|
|
r.append((root.replace(sourcedir, destdir, 1), l))
|
|
|
|
return r
|
|
|
|
|
2015-03-09 17:34:11 +01:00
|
|
|
class compile_translations(Command):
|
|
|
|
description = 'compile message catalogs to MO files via django compilemessages'
|
|
|
|
user_options = []
|
|
|
|
|
|
|
|
def initialize_options(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
try:
|
|
|
|
from django.core.management import call_command
|
2015-03-10 09:51:35 +01:00
|
|
|
for path, dirs, files in os.walk('combo'):
|
2015-03-09 17:34:11 +01:00
|
|
|
if 'locale' not in dirs:
|
|
|
|
continue
|
|
|
|
curdir = os.getcwd()
|
|
|
|
os.chdir(os.path.realpath(path))
|
|
|
|
call_command('compilemessages')
|
|
|
|
os.chdir(curdir)
|
|
|
|
except ImportError:
|
|
|
|
sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
|
|
|
|
|
|
|
|
|
2018-01-21 10:46:41 +01:00
|
|
|
class compile_scss(Command):
|
|
|
|
description = 'compile scss files into css files'
|
|
|
|
user_options = []
|
|
|
|
|
|
|
|
def initialize_options(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
sass_bin = None
|
|
|
|
for program in ('sass', 'sassc'):
|
|
|
|
sass_bin = find_executable(program)
|
|
|
|
if sass_bin:
|
|
|
|
break
|
|
|
|
if not sass_bin:
|
|
|
|
raise CompileError('A sass compiler is required but none was found. See sass-lang.com for choices.')
|
|
|
|
|
2018-01-26 12:46:35 +01:00
|
|
|
for path, dirnames, filenames in os.walk('combo'):
|
|
|
|
for filename in filenames:
|
|
|
|
if not filename.endswith('.scss'):
|
|
|
|
continue
|
|
|
|
if filename.startswith('_'):
|
|
|
|
continue
|
|
|
|
subprocess.check_call([sass_bin, '%s/%s' % (path, filename),
|
|
|
|
'%s/%s' % (path, filename.replace('.scss', '.css'))])
|
2018-01-21 10:46:41 +01:00
|
|
|
|
|
|
|
|
2015-03-09 17:34:11 +01:00
|
|
|
class build(_build):
|
2018-01-21 10:46:41 +01:00
|
|
|
sub_commands = [('compile_translations', None),
|
|
|
|
('compile_scss', None) ] + _build.sub_commands
|
2015-03-09 17:34:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
class install_lib(_install_lib):
|
|
|
|
def run(self):
|
|
|
|
self.run_command('compile_translations')
|
|
|
|
_install_lib.run(self)
|
|
|
|
|
2014-12-23 09:41:14 +01:00
|
|
|
|
|
|
|
setup(
|
|
|
|
name='combo',
|
|
|
|
version=get_version(),
|
|
|
|
description='Content Manager',
|
|
|
|
author='Frederic Peters',
|
|
|
|
author_email='fpeters@entrouvert.com',
|
|
|
|
packages=find_packages(),
|
|
|
|
include_package_data=True,
|
|
|
|
scripts=('manage.py',),
|
2015-12-28 14:25:13 +01:00
|
|
|
data_files=data_tree('share/publik/themes/', 'data/themes/'),
|
2014-12-23 09:41:14 +01:00
|
|
|
url='https://dev.entrouvert.org/projects/combo/',
|
|
|
|
classifiers=[
|
|
|
|
'Development Status :: 2 - Pre-Alpha',
|
|
|
|
'Environment :: Web Environment',
|
|
|
|
'Framework :: Django',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
|
|
|
|
'Operating System :: OS Independent',
|
|
|
|
'Programming Language :: Python',
|
|
|
|
'Programming Language :: Python :: 2',
|
|
|
|
],
|
2017-04-24 15:25:45 +02:00
|
|
|
install_requires=['django>=1.8, <1.12',
|
2015-09-07 09:51:16 +02:00
|
|
|
'django-ckeditor<4.5.3',
|
2014-12-07 16:03:47 +01:00
|
|
|
'gadjo',
|
2015-08-26 08:30:08 +02:00
|
|
|
'feedparser',
|
2015-05-21 09:40:51 +02:00
|
|
|
'django-jsonfield',
|
2015-09-18 12:25:45 +02:00
|
|
|
'requests',
|
2015-12-06 11:26:07 +01:00
|
|
|
'XStatic-ChartNew.js',
|
2017-05-15 19:01:38 +02:00
|
|
|
'XStatic-Leaflet',
|
2017-10-18 10:46:34 +02:00
|
|
|
'XStatic_JosefinSans',
|
2017-09-05 15:21:23 +02:00
|
|
|
'XStatic_OpenSans',
|
|
|
|
'XStatic_roboto-fontface',
|
2016-08-23 08:11:20 +02:00
|
|
|
'eopayment>=1.13',
|
2015-12-30 17:58:54 +01:00
|
|
|
'python-dateutil',
|
2016-11-18 15:24:41 +01:00
|
|
|
'djangorestframework>=3.3, <3.4',
|
2015-06-06 16:16:19 +02:00
|
|
|
'django-haystack',
|
|
|
|
'whoosh',
|
2017-05-15 14:10:06 +02:00
|
|
|
'sorl-thumbnail',
|
|
|
|
'Pillow',
|
2014-12-07 15:34:30 +01:00
|
|
|
],
|
2014-12-23 09:41:14 +01:00
|
|
|
zip_safe=False,
|
2015-03-09 17:34:11 +01:00
|
|
|
cmdclass={
|
|
|
|
'build': build,
|
2018-01-21 10:46:41 +01:00
|
|
|
'compile_scss': compile_scss,
|
2015-03-09 17:34:11 +01:00
|
|
|
'compile_translations': compile_translations,
|
|
|
|
'install_lib': install_lib,
|
|
|
|
'sdist': eo_sdist,
|
|
|
|
},
|
2014-12-23 09:41:14 +01:00
|
|
|
)
|