setup.py: don't install Django during setup

This commit is contained in:
Jérôme Schneider 2013-08-09 17:39:13 +02:00
parent e2078f98c2
commit 69339c7cd4
1 changed files with 17 additions and 18 deletions

View File

@ -20,22 +20,25 @@ class compile_translations(Command):
def run(self):
import os
import sys
from django.core.management.commands.compilemessages import \
compile_messages
for path in ['compte_agglo_montpellier'] + glob.glob('compte_agglo_montpellier/apps/*'):
if not os.path.exists(os.path.join(path, 'locale')):
continue
curdir = os.getcwd()
os.chdir(os.path.realpath(path))
compile_messages(stderr=sys.stderr)
os.chdir(curdir)
try:
from django.core.management.commands.compilemessages import \
compile_messages
for path in ['compte_agglo_montpellier'] + glob.glob('compte_agglo_montpellier/apps/*'):
if not os.path.exists(os.path.join(path, 'locale')):
continue
curdir = os.getcwd()
os.chdir(os.path.realpath(path))
compile_messages(stderr=sys.stderr)
os.chdir(curdir)
except ImportError:
print
sys.stderr.write('!!! Please install Django >= 1.4 to build translations')
print
print
class build(_build):
sub_commands = [('compile_translations', None)] + _build.sub_commands
class sdist(_sdist):
sub_commands = [('compile_translations', None)] + _sdist.sub_commands
class install_lib(_install_lib):
def run(self):
self.run_command('compile_translations')
@ -92,7 +95,7 @@ setup(name="compte-agglo-montpellier",
'static/**.gif',
'static/**.css',
'static/**.js',
'locale/**.mo',
'locale/**.mo',
'fixtures/*.json',
]
},
@ -106,14 +109,10 @@ setup(name="compte-agglo-montpellier",
'gunicorn',
'demjson',
],
setup_requires=[
'django>=1.4',
],
dependency_links = [
'git+git://repos.entrouvert.org/portail-citoyen#egg=portail-citoyen-0.1.99999',
'git+git://repos.entrouvert.org/portail-citoyen-announces#egg=portail-citoyen-announces-0.1.99999',
],
cmdclass={'build': build, 'install_lib': install_lib,
'compile_translations': compile_translations,
'sdist': sdist},
'compile_translations': compile_translations},
)