Sfoglia il codice sorgente

Add setup.py to prepare switch to distutils, improve locale handling

Helmut Pozimski 11 anni fa
parent
commit
0b2ccbc6bf
2 ha cambiato i file con 39 aggiunte e 1 eliminazioni
  1. 35 0
      setup.py
  2. 4 1
      stov.py

+ 35 - 0
setup.py

@@ -0,0 +1,35 @@
+#! /usr/bin/env python
+
+#
+#        This file is part of stov, written by Helmut Pozimski 2012-2013.
+#
+#       stov is free software: you can redistribute it and/or modify
+#       it under the terms of the GNU General Public License as published by
+#       the Free Software Foundation, version 2 of the License.
+#
+#       stov is distributed in the hope that it will be useful,
+#       but WITHOUT ANY WARRANTY; without even the implied warranty of
+#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#       GNU General Public License for more details.
+#
+#       You should have received a copy of the GNU General Public License
+#       along with stov.  If not, see <http://www.gnu.org/licenses/>.
+
+
+# -*- coding: utf8 -*-
+
+from distutils.core import setup
+
+setup(
+	name = "stov",
+	version = "0.5wip",
+	author = "Helmut Pozimski",
+	author_email = "helmut@pozimski.de",
+	py_modules = ["youtube", "youtubeAPI", "outputhelper", "subscription",
+		"configuration"],
+	scripts = ["stov.py"],
+	data_files = [("share/locale/de/LC_MESSAGES", ["locale/de/LC_MESSAGES/stov.mo" ]), 
+			("share/locale/C/LC_MESSAGES", ["locale/C/LC_MESSAGES/stov.mo"]),
+			("share/locale/en/LC_MESSAGES", ["locale/en/LC_MESSAGES/stov.mo"])]
+	)		
+

+ 4 - 1
stov.py

@@ -42,7 +42,10 @@ from outputhelper import printf
 
 """Determine the path where the stov files are for localization"""
 
-locale_path = sys.path[0] + "/locale"
+locale_path = os.path.join(sys.path[0] + "/locale")
+if gettext.find("stov", locale_path) == None:
+	base_path = os.path.split(sys.path[0])[0]
+	locale_path = os.path.join(base_path, "share/locale")
 
 """Initialize gettext to support translation of the program"""