Properly save offlate version
offlate/VERSION unknown status 1
1 | + | 0.5.preview |
offlate/manager.py
89 | 89 | return False | |
90 | 90 | ||
91 | 91 | try: | |
92 | - | data["version"] = "0.3" | |
93 | 92 | proj = self.loadProject(name, lang, system, data) | |
94 | 93 | proj.initialize(projectpath, callback) | |
95 | 94 | self.projects.append({"name": name, "lang": lang, "system": system, | |
… | |||
107 | 106 | def loadProject(self, name, lang, system, data): | |
108 | 107 | if not "Generic" in self.settings.conf: | |
109 | 108 | self.settings.conf["Generic"] = {} | |
109 | + | ||
110 | + | version_file = open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'VERSION')) | |
111 | + | self.settings.conf["Generic"]["offlate_version"] = version_file.read().strip() | |
112 | + | ||
110 | 113 | if system == TRANSLATION_PROJECT: | |
111 | 114 | if not "TP" in self.settings.conf: | |
112 | 115 | self.settings.conf["TP"] = {} |
offlate/systems/git.py
86 | 86 | translationfiles.append({'filename': popath, | |
87 | 87 | 'format': GettextFormat({'file': path + popath, | |
88 | 88 | 'pot': path + potpath, | |
89 | - | 'version': self.data['version'], | |
89 | + | 'version': self.conf['offlate_version'], | |
90 | 90 | 'fullname': self.conf['fullname'], | |
91 | 91 | 'lang': self.lang})}) | |
92 | 92 | elif resource['file_format'] == 'yaml': |
offlate/systems/tp.py
102 | 102 | newcontent = GettextFormat( | |
103 | 103 | {'file': self.popath, | |
104 | 104 | 'pot': self.potpath, | |
105 | - | 'version': '0.1', | |
105 | + | 'version': self.conf['offlate_version'], | |
106 | 106 | 'fullname': self.conf['fullname'], | |
107 | 107 | 'lang': self.lang}) | |
108 | 108 | content = GettextFormat( | |
109 | 109 | {'file': oldpath, | |
110 | 110 | 'pot': self.potpath, | |
111 | - | 'version': '0.1', | |
111 | + | 'version': self.conf['offlate_version'], | |
112 | 112 | 'fullname': self.conf['fullname'], | |
113 | 113 | 'lang': self.lang}) | |
114 | 114 | newcontent.merge(content, askmerge) | |
… | |||
138 | 138 | self.po = GettextFormat( | |
139 | 139 | {'file': self.popath, | |
140 | 140 | 'pot': self.potpath, | |
141 | - | 'version': '0.1', | |
141 | + | 'version': self.conf['offlate_version'], | |
142 | 142 | 'fullname': self.conf['fullname'], | |
143 | 143 | 'lang': self.lang}) | |
144 | 144 | return {'default': self.po.content()} |
setup.py
1 | 1 | from setuptools import setup, find_packages | |
2 | 2 | import distutils | |
3 | + | import os | |
3 | 4 | ||
4 | 5 | class LocalesCommand(distutils.cmd.Command): | |
5 | 6 | description='compile locale files' | |
… | |||
7 | 8 | command = ["make" "update-langs"] | |
8 | 9 | subprocess.check_call(command) | |
9 | 10 | ||
11 | + | ||
12 | + | version_file = open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'offlate', 'VERSION')) | |
13 | + | version = version_file.read().strip() | |
14 | + | ||
10 | 15 | setup ( | |
11 | 16 | name="offlate", | |
12 | - | version="0.4.0", | |
17 | + | version=version, | |
13 | 18 | packages=find_packages(exclude=['.guix-profile*']), | |
14 | 19 | python_requires = '>=3', | |
15 | 20 | install_requires=['polib', 'ruamel.yaml', 'python-dateutil', 'PyQt5', 'pygit2', | |
… | |||
21 | 26 | ] | |
22 | 27 | }, | |
23 | 28 | ||
24 | - | package_data={'offlate': ['data.json', 'locales/*.qm', 'locales/*.ts', 'icon.png']}, | |
29 | + | package_data={'offlate': ['data.json', 'locales/*.qm', 'locales/*.ts', 'icon.png', 'VERSION']}, | |
25 | 30 | cmdclass={ | |
26 | 31 | 'locales': LocalesCommand, | |
27 | 32 | }, |