[mousetrap/gnome3-wip: 165/240] Do not exclude *.mo files
- From: Heidi Ellis <heidiellis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mousetrap/gnome3-wip: 165/240] Do not exclude *.mo files
- Date: Mon, 8 Sep 2014 15:26:26 +0000 (UTC)
commit 0cd1bb88a4af40b37e27c5962b869948f8997375
Author: Kevin Brown <kevin kevinbrown in>
Date: Wed Jun 25 21:57:54 2014 -0400
Do not exclude *.mo files
Previously *.mo files were excluded from the distribution as they
are generated during the install process. Because the manifest is
checked after we generate the locale files, the files were still
not being installed and would not be picked up by MouseTrap. With
the changes described below, the files are being generated by the
installer and still are not being included in the distributions.
During the `egg_info` command, which is run before building and
installing packages, the previously generated files are being
automatically removed. A check has been added to ensure that this
is not done during the installation process, which would have
previously removed the newly generated locale files.
`self.distribution.script_args` is a list containing the arguments
included when the command was run. For the installer, the first
argument is "install", which is what the script checks for.
MANIFEST.in | 1 -
setup.py | 13 +++++++++++++
2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/MANIFEST.in b/MANIFEST.in
index e5bd24f..be54547 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -3,4 +3,3 @@ recursive-include src/mousetrap/locale *
recursive-include src/mousetrap/haars *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
-recursive-exclude * *.mo
diff --git a/setup.py b/setup.py
index f1c824d..9a91d0f 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,7 @@
from setuptools import setup, find_packages
from setuptools.command.egg_info import egg_info
from setuptools.command.install import install
+import glob
import os
import sys
@@ -13,6 +14,8 @@ from mousetrap import __version__
PYTHON_VERSION = sys.version_info
+LOCALE_PATH = "src/mousetrap/locale"
+
all_requirements = [
"pygobject",
"pyyaml",
@@ -94,6 +97,16 @@ On yum-based systems:
The installation not work as expected without this dependency.
""")
+ if not "install" in self.distribution.script_args:
+ sys.stdout.write("Removing generated locale files...\n")
+
+ compiled_files = glob.glob(LOCALE_PATH + "/**/LC_MESSAGES/*.mo")
+
+ for file_name in compiled_files:
+ sys.stdout.write("Removing compiled locale %s\n" % file_name)
+
+ os.remove(file_name)
+
egg_info.run(self)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]