python linted

This commit is contained in:
Tux 2023-07-24 15:53:26 +02:00
parent e562e63c8e
commit 41965be322

View File

@ -3,7 +3,8 @@ import os
import inspect import inspect
dir = os.path.dirname(inspect.getfile(inspect.currentframe())) dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
if dir == '': dir = '.' if dir == '':
dir = '.'
print(('dir = %s' % dir)) print(('dir = %s' % dir))
os.chdir(dir) os.chdir(dir)
@ -24,15 +25,18 @@ if os.path.exists(in_file):
output.write(input.read()) output.write(input.read())
output.write('"""\n') output.write('"""\n')
finally: finally:
if input is not None: input.close() if input is not None:
if output is not None: output.close() input.close()
if output is not None:
output.close()
# Bootstrap # Bootstrap
try: try:
import ez_setup import ez_setup
ez_setup.use_setuptools() ez_setup.use_setuptools()
except: pass except ImportError:
pass
app = 'FAHControl' app = 'FAHControl'
@ -40,24 +44,24 @@ if sys.platform == 'darwin':
from setuptools import setup from setuptools import setup
plist = dict( plist = dict(
CFBundleDisplayName = 'FAHControl', CFBundleDisplayName='FAHControl',
CFBundleIdentifier = 'org.foldingathome.fahcontrol', CFBundleIdentifier='org.foldingathome.fahcontrol',
CFBundleSignature = '????', CFBundleSignature='????',
NSHumanReadableCopyright = 'Copyright 2010-2018 foldingathome.org', NSHumanReadableCopyright='Copyright 2010-2018 foldingathome.org',
) )
options = dict( options = dict(
argv_emulation = False, argv_emulation=False,
includes = 'cairo, pango, pangocairo, atk, gobject, gio', includes='cairo, pango, pangocairo, atk, gobject, gio',
iconfile = 'images/FAHControl.icns', iconfile='images/FAHControl.icns',
resources = ['osx/themes', 'osx/entitlements.plist'], resources=['osx/themes', 'osx/entitlements.plist'],
plist = plist, plist=plist,
) )
extra_opts = dict( extra_opts = dict(
app = [app], app=[app],
options = {'py2app': options}, options={'py2app': options},
setup_requires = ['py2app'], setup_requires=['py2app'],
) )
# Hack around py2app problem with python scripts with out .py extension. # Hack around py2app problem with python scripts with out .py extension.
@ -68,38 +72,39 @@ elif sys.platform == 'win32':
from cx_Freeze import setup, Executable from cx_Freeze import setup, Executable
# Change base to 'Console' for debugging # Change base to 'Console' for debugging
e = Executable(app, base = 'Win32GUI', icon = 'images/FAHControl.ico') e = Executable(app, base='Win32GUI', icon='images/FAHControl.ico')
options = { options = {
'build_exe': { 'build_exe': {
'build_exe': 'gui', 'build_exe': 'gui',
'includes': 'gtk' 'includes': 'gtk'
} }
} }
extra_opts = dict(executables = [e], options = options) extra_opts = dict(executables=[e], options=options)
else: else:
from setuptools import setup, find_packages from setuptools import setup, find_packages
extra_opts = dict( extra_opts = dict(
packages = find_packages(), packages=find_packages(),
scripts = [app], scripts=[app],
data_files = [('/usr/share/pixmaps', ['images/FAHControl.png'])], data_files=[('/usr/share/pixmaps', ['images/FAHControl.png'])],
install_requires = 'gtk2 >= 2.14.0', install_requires='gtk2 >= 2.14.0',
include_package_data = True, include_package_data=True,
) )
try: try:
version = open('version.txt').read().strip() version = open('version.txt').read().strip()
version.split('.') version.split('.')
except: version = '0.0.0' except:
version = '0.0.0'
if not os.path.exists('fah/Version.py') or version != '0.0.0': if not os.path.exists('fah/Version.py') or version != '0.0.0':
open('fah/Version.py', 'w').write('version = \'%s\'\n' % version) open('fah/Version.py', 'w').write('version = \'%s\'\n' % version)
description = \ description = \
'''Folding@home is a distributed computing project using volunteered '''Folding@home is a distributed computing project using volunteered
computer resources. computer resources.
''' '''
short_description = ''' short_description = '''
This package contains FAHControl, a graphical monitor and control This package contains FAHControl, a graphical monitor and control
utility for the Folding@home client. It gives an overview of running utility for the Folding@home client. It gives an overview of running
@ -111,16 +116,16 @@ additional information and settings for enthusiasts and gurus.'''
description += short_description description += short_description
setup( setup(
name = 'FAHControl', name='FAHControl',
version = version, version=version,
description = 'Folding@home Client Control', description='Folding@home Client Control',
long_description = description, long_description=description,
author = 'Joseph Coffland', author='Joseph Coffland',
author_email = 'joseph@cauldrondevelopment.com', author_email='joseph@cauldrondevelopment.com',
license = 'GNU General Public License version 3', license='GNU General Public License version 3',
keywords = 'protein, molecular dynamics, simulation', keywords='protein, molecular dynamics, simulation',
url = 'https://foldingathome.org/', url='https://foldingathome.org/',
package_data = {'fah': ['*.glade']}, package_data={'fah': ['*.glade']},
**extra_opts) **extra_opts)
if sys.platform == 'darwin': if sys.platform == 'darwin':