autopep8 setup.py

This commit is contained in:
André Apitzsch 2017-09-19 00:00:00 +02:00
parent 289c67fd8a
commit af89d7cfa6
1 changed files with 40 additions and 32 deletions

72
setup.py Normal file → Executable file
View File

@ -72,10 +72,11 @@ def build_trans(build_cmd):
raise SystemExit(msg) raise SystemExit(msg)
log.info('Compiling %s >> %s', po_file, mo_file) log.info('Compiling %s >> %s', po_file, mo_file)
#linux specific piece: # linux specific piece:
target = 'share/locale/' + lang + '/LC_MESSAGES' target = 'share/locale/' + lang + '/LC_MESSAGES'
data_files.append((target, [mo_file])) data_files.append((target, [mo_file]))
def build_man(build_cmd): def build_man(build_cmd):
''' '''
Compress Gajim manual files Compress Gajim manual files
@ -96,16 +97,17 @@ def build_man(build_cmd):
filename = False filename = False
if filename: if filename:
#Binary io, so open is OK # Binary io, so open is OK
with open(filename, 'rb') as f_in,\ with open(filename, 'rb') as f_in,\
gzip.open(man_file_gz, 'wb') as f_out: gzip.open(man_file_gz, 'wb') as f_out:
f_out.writelines(f_in) f_out.writelines(f_in)
log.info('Compiling %s >> %s', filename, man_file_gz) log.info('Compiling %s >> %s', filename, man_file_gz)
src = cwd + '/man' + '/' + man + '.gz' src = cwd + '/man' + '/' + man + '.gz'
target = 'share/man/man1' target = 'share/man/man1'
data_files.append((target, [src])) data_files.append((target, [src]))
def build_intl(build_cmd): def build_intl(build_cmd):
''' '''
Merge translation files into desktop and mime files Merge translation files into desktop and mime files
@ -126,6 +128,7 @@ def build_intl(build_cmd):
merge(filenamelocal + '.in', newfile, option) merge(filenamelocal + '.in', newfile, option)
data_files.append((target, [base + '/' + filename])) data_files.append((target, [base + '/' + filename]))
def substitute_variables(filename_in, filename_out, subst_vars): def substitute_variables(filename_in, filename_out, subst_vars):
''' '''
Substitute variables in a file. Substitute variables in a file.
@ -146,14 +149,14 @@ def merge(in_file, out_file, option, po_dir='po'):
''' '''
if os.path.exists(in_file): if os.path.exists(in_file):
cmd = (('msgfmt %(opt)s -d %(po_dir)s --template %(in_file)s ' cmd = (('msgfmt %(opt)s -d %(po_dir)s --template %(in_file)s '
'-o %(out_file)s') % '-o %(out_file)s') %
{'opt' : option, {'opt': option,
'po_dir' : po_dir, 'po_dir': po_dir,
'in_file' : in_file, 'in_file': in_file,
'out_file' : out_file}) 'out_file': out_file})
if os.system(cmd) != 0: if os.system(cmd) != 0:
msg = ('ERROR: %s was not merged into the translation files!\n' % msg = ('ERROR: %s was not merged into the translation files!\n' %
out_file) out_file)
raise SystemExit(msg) raise SystemExit(msg)
log.info('Compiling %s >> %s', in_file, out_file) log.info('Compiling %s >> %s', in_file, out_file)
@ -180,12 +183,14 @@ class test(Command):
def run(self): def run(self):
os.system("./test/runtests.py") os.system("./test/runtests.py")
class test_nogui(test): class test_nogui(test):
description = "Run tests without GUI" description = "Run tests without GUI"
def run(self): def run(self):
os.system("./test/runtests.py -n") os.system("./test/runtests.py -n")
class update_po(Command): class update_po(Command):
description = "Update po files" description = "Update po files"
user_options = [] user_options = []
@ -229,40 +234,43 @@ package_data = (package_data_activities
# only install subdirectories of data # only install subdirectories of data
data_files_app_icon = [ data_files_app_icon = [
("share/icons/hicolor/64x64/apps", ["gajim/data/icons/hicolor/64x64/apps/org.gajim.Gajim.png"]), ("share/icons/hicolor/64x64/apps",
("share/icons/hicolor/128x128/apps", ["gajim/data/icons/hicolor/128x128/apps/org.gajim.Gajim.png"]), ["gajim/data/icons/hicolor/64x64/apps/org.gajim.Gajim.png"]),
("share/icons/hicolor/scalable/apps", ["gajim/data/icons/hicolor/scalable/apps/org.gajim.Gajim.svg"]) ("share/icons/hicolor/128x128/apps",
] ["gajim/data/icons/hicolor/128x128/apps/org.gajim.Gajim.png"]),
("share/icons/hicolor/scalable/apps",
["gajim/data/icons/hicolor/scalable/apps/org.gajim.Gajim.svg"])
]
data_files = data_files_app_icon data_files = data_files_app_icon
setup( setup(
name = "gajim", name="gajim",
description = 'A GTK+ Jabber client', description='A GTK+ Jabber client',
version = gajim.__version__, version=gajim.__version__,
author = "Philipp Hörist, Yann Leboulanger", author="Philipp Hörist, Yann Leboulanger",
author_email = "gajim-devel@gajim.org", author_email="gajim-devel@gajim.org",
url = 'https://gajim.org', url='https://gajim.org',
license = 'GPL v3', license='GPL v3',
classifiers = [ classifiers=[
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
], ],
cmdclass = { cmdclass={
'build_py': build, 'build_py': build,
'test': test, 'test': test,
'test_nogui': test_nogui, 'test_nogui': test_nogui,
'update_po': update_po, 'update_po': update_po,
}, },
scripts = [ scripts=[
'scripts/gajim', 'scripts/gajim',
'scripts/gajim-history-manager', 'scripts/gajim-history-manager',
'scripts/gajim-remote' ], 'scripts/gajim-remote'],
packages = find_packages(exclude=["gajim.dev", "test*"]), packages=find_packages(exclude=["gajim.dev", "test*"]),
package_data = {'gajim': package_data}, package_data={'gajim': package_data},
data_files = data_files, data_files=data_files,
install_requires = [ install_requires=[
'dbus-python', 'dbus-python',
'nbxmpp', 'nbxmpp',
'pyOpenSSL' 'pyOpenSSL'
], ],
) )