File indexing completed on 2023-05-30 11:04:13
0001 #!/usr/bin/env python3 0002 # -*- coding: utf-8 -*- 0003 0004 """ 0005 Copyright (C) 2008-2017 Wolfgang Rohdewald <wolfgang@rohdewald.de> 0006 0007 SPDX-License-Identifier: GPL-2.0 0008 0009 Start this in the installation directory of Kajongg: That 0010 is where this program resides. Below you find a code 0011 block that might have to be adapted. 0012 """ 0013 0014 from distutils.core import setup 0015 from distutils.command.build import build 0016 from subprocess import call 0017 0018 import re 0019 import os 0020 0021 # Adapt this range: ======================================================= 0022 FULLAUTHOR = "Wolfgang Rohdewald <wolfgang@rohdewald.de>" 0023 LICENSE = 'GNU General Public License v2' 0024 URL = "https://apps.kde.org/kajongg" 0025 try: 0026 from appversion import VERSION 0027 except ImportError: 0028 VERSION = "Unknown" 0029 0030 # ======================================================= 0031 0032 # This most certainly does not run on Windows. We do not care for now. 0033 # at least all / in paths would have to be changed 0034 0035 (AUTHOR, EMAIL) = re.match('^(.*?)\s*<(.*)>$', FULLAUTHOR).groups() 0036 0037 os.umask(0o0022) # files should be readable and executable by everybody 0038 0039 kdeDirs = {} 0040 for type in 'exe', 'data', 'xdgdata-apps', 'icon', 'html': 0041 kdeDirs[type] = os.popen("kf5-config --expandvars --install %s" % type).read().strip() 0042 kdeDirs['iconApps'] = os.path.join(kdeDirs['icon'], 'hicolor', 'scalable', 'apps') 0043 kdeDirs['iconActions'] = os.path.join(kdeDirs['icon'], 'hicolor', 'scalable', 'actions') 0044 0045 app_files = [os.path.join('src', x) for x in os.listdir('src') if x.endswith('.py') or x.endswith('.ui')] 0046 app_files.append('src/kajonggui.rc') 0047 app_files.append('COPYING') 0048 app_files.append('COPYING.DOC') 0049 0050 doc_files = [os.path.join('doc', x) for x in os.listdir('doc') if x.endswith('.png')] 0051 0052 for ignFile in os.listdir('src'): 0053 if ignFile.endswith('.pyc'): 0054 os.remove(os.path.join('src', ignFile)) 0055 0056 data_files = [ \ 0057 (kdeDirs['exe'], ['kajongg', 'kajonggserver']), 0058 (os.path.join(kdeDirs['data'], 'kajongg'), app_files), 0059 (os.path.join(kdeDirs['html'], 'en', 'kajongg'), doc_files), 0060 (kdeDirs['xdgdata-apps'], ['org.kde.kajongg.desktop']), 0061 ('/usr/share/doc/kajongg/', ['COPYING.DOC']), 0062 (kdeDirs['iconApps'], ['kajongg.svgz']), 0063 (kdeDirs['iconActions'], ['games-kajongg-law.svgz'])] 0064 0065 voice_directories = [x for x in os.listdir('voices') if x.startswith('male') or x.startswith('female')] 0066 for directory in voice_directories: 0067 data_files.append((os.path.join(kdeDirs['data'], 'kajongg', 'voices', directory), [os.path.join('voices', directory, x) for x in os.listdir(os.path.join('voices', directory))])) 0068 0069 extra = {} 0070 # extra['requires'] = ('pyQt4', 'sdf') does not do anything 0071 0072 class KmjBuild(build): 0073 0074 def run(self): 0075 for binary in ['kajongg', 'kajonggserver']: 0076 open(binary, 'w').write('#!/bin/sh\nexec %skajongg/%s.py $*\n' % (kdeDirs['data'], binary)) 0077 os.chmod(binary, 0o0755) 0078 call(['cp sc-apps-kajongg.svgz kajongg.svgz'], shell=True) 0079 call(['cp sc-action-games-kajongg-law.svgz games-kajongg-law.svgz'], shell=True) 0080 build.run(self) 0081 0082 0083 setup(name='kajongg', 0084 version=VERSION, 0085 description='The classical game of Mah Jongg', 0086 long_description="This is the classical Mah Jongg for four players. " 0087 "If you are looking for the Mah Jongg solitaire please use the " 0088 "application kmahjongg.", 0089 author=AUTHOR, 0090 author_email=EMAIL, 0091 url=URL, 0092 download_url='https://www.linux-apps.com/p/1109453/', 0093 data_files=data_files, 0094 cmdclass = { 'build' : KmjBuild }, # define custom build class 0095 license=LICENSE, 0096 classifiers=['Development Status :: 4 - Beta', 0097 'License :: OSI Approved :: GNU General Public License (GPL)', 0098 'Operating System :: OS Independent', 0099 'Environment :: X11 Applications :: KDE', 0100 'Topic :: Desktop Environment :: K Desktop Environment (KDE)', 0101 'Topic :: Games:: Board Games', 0102 'Intended Audience :: End Users/Desktop', 0103 'Programming Language :: Python',], 0104 **extra)