setup.py: prevent errors in compile_translations to mess with the current working directory
This commit is contained in:
parent
f18706c051
commit
45ca70f674
8
setup.py
8
setup.py
|
@ -15,8 +15,6 @@ from distutils.command.build import build as _build
|
||||||
from distutils.command.sdist import sdist
|
from distutils.command.sdist import sdist
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(__file__)
|
|
||||||
|
|
||||||
class eo_sdist(sdist):
|
class eo_sdist(sdist):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
@ -63,17 +61,19 @@ class compile_translations(Command):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
curdir = os.getcwd()
|
||||||
try:
|
try:
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
for path, dirs, files in os.walk('gadjo'):
|
for path, dirs, files in os.walk('gadjo'):
|
||||||
if 'locale' not in dirs:
|
if 'locale' not in dirs:
|
||||||
continue
|
continue
|
||||||
curdir = os.getcwd()
|
|
||||||
os.chdir(os.path.realpath(path))
|
os.chdir(os.path.realpath(path))
|
||||||
call_command('compilemessages')
|
call_command('compilemessages')
|
||||||
os.chdir(curdir)
|
os.chdir(curdir)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
|
sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
|
||||||
|
finally:
|
||||||
|
os.chdir(curdir)
|
||||||
|
|
||||||
|
|
||||||
class build_icons(Command):
|
class build_icons(Command):
|
||||||
|
@ -87,7 +87,7 @@ class build_icons(Command):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
destpath = os.path.join(BASE_DIR, 'gadjo/static/css/icons/')
|
destpath = 'gadjo/static/css/icons/'
|
||||||
if not os.path.exists(destpath):
|
if not os.path.exists(destpath):
|
||||||
os.mkdir(destpath)
|
os.mkdir(destpath)
|
||||||
variants = {
|
variants = {
|
||||||
|
|
Loading…
Reference in New Issue