Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Found a way to compile po files on install.

It's not perfect, but it works:

- if running sdist, it removes existing mo files
- else it checks that django is installed and if so builds the mo files
  • Loading branch information...
commit 1ac8be2df70e54948079a0811d14c0345d93854d 1 parent f9ccefe
@jpic jpic authored
Showing with 22 additions and 5 deletions.
  1. +1 −1  MANIFEST.in
  2. +21 −4 setup.py
View
2  MANIFEST.in
@@ -1,2 +1,2 @@
include *.rst *.txt README LICENSE AUTHORS CHANGELOG
-recursive-include autocomplete_light *.html *.css *.js *.py *.po
+recursive-include autocomplete_light *.html *.css *.js *.py *.po *.mo
View
25 setup.py
@@ -36,10 +36,27 @@ def run(self):
__file__, "test", "autocomplete_light"])
os.chdir(this_dir)
-dir = os.getcwd()
-os.chdir(os.path.join(dir, 'autocomplete_light'))
-os.system('django-admin.py compilemessages')
-os.chdir(dir)
+if 'sdist' in sys.argv:
+ # clear compiled mo files before building the distribution
+ walk = os.walk(os.path.join(os.getcwd(), 'autocomplete_light/locale'))
+ for dirpath, dirnames, filenames in walk:
+ if not filenames:
+ continue
+
+ if 'django.mo' in filenames:
+ os.unlink(os.path.join(dirpath, 'django.mo'))
+ print 'unlink', os.path.join(dirpath, 'django.mo')
+else:
+ # if django is there, compile the po files to mo,
+ try:
+ import django
+ except ImportError:
+ pass
+ else:
+ dir = os.getcwd()
+ os.chdir(os.path.join(dir, 'autocomplete_light'))
+ os.system('django-admin.py compilemessages')
+ os.chdir(dir)
setup(
name='django-autocomplete-light',
Please sign in to comment.
Something went wrong with that request. Please try again.