Skip to content

Commit

Permalink
setup.py: fix installation on Python 3.12+
Browse files Browse the repository at this point in the history
  • Loading branch information
liushuyu committed Apr 22, 2024
1 parent a5a14ff commit e85562f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
import sys
import glob
from setuptools import setup
from setuptools import setup, Command
import DistUtilsExtra.command.build_extra
import DistUtilsExtra.command.build_i18n
import DistUtilsExtra.command.clean_i18n
Expand All @@ -15,6 +15,15 @@

PO_DIR = 'po'


class CleanCommand(DistUtilsExtra.command.clean_i18n.clean_i18n):
user_options = [('all', None, '(Compatibility with original clean command)')]

def initialize_options(self):
self.all = False
super().initialize_options()


for po in glob.glob(os.path.join(PO_DIR, '*.po')):
lang = os.path.basename(po[:-3])
mo = os.path.join(PO_DIR, 'ubuntu-kylin-software-center.mo')
Expand All @@ -24,14 +33,14 @@
try:
return_code = call(['msgfmt', '-o', mo, po])
except OSError:
print('Translation not available, please install gettext')
raise Warning('Translation not available, please install gettext')
break
if return_code:
raise Warning('Error when building locales')
cmdclass ={
"build" : DistUtilsExtra.command.build_extra.build_extra,
"build_i18n" : DistUtilsExtra.command.build_i18n.build_i18n,
"clean": DistUtilsExtra.command.clean_i18n.clean_i18n,
"clean": CleanCommand,
}


Expand Down

0 comments on commit e85562f

Please sign in to comment.