/usr/share/pyshared/pybridge/environment.py is in pybridge-common 0.3.0-7.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | # PyBridge -- online contract bridge made easy.
# Copyright (C) 2004-2007 PyBridge Project.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import os
import sys
"""
This module provides path location services for PyBridge.
Note to PyBridge packagers:
The packaging policy of your distribution may specify a filesystem organisation
standard, which conflicts with the directory structure defined in this module.
This is the only module that you should need to modify to make PyBridge
compliant with distribution policy.
"""
# Locate base directory.
if hasattr(sys, 'frozen'): # If py2exe distribution.
currentdir = os.path.dirname(sys.executable)
basedir = os.path.abspath(currentdir)
else: # Typically /usr/ (if installed) or root of source distribution.
currentdir = os.path.dirname(os.path.abspath(sys.argv[0]))
basedir = os.path.normpath(os.path.join(currentdir, '..'))
# Locate shared resources directory, typically /usr/share/.
if os.path.exists(os.path.join(basedir, 'share')):
sharedir = os.path.join(basedir, 'share')
else: # Root of source distribution.
sharedir = basedir
# Locate client configuration directory, typically ~/.pybridge/.
clientconfigdir = os.path.join(os.path.expanduser('~'), '.pybridge')
if not os.path.exists(clientconfigdir):
os.mkdir(clientconfigdir) # Create directory.
# Locate server configuration directory.
serverconfigdir = clientconfigdir
def find_config_client(name):
"""A client configuration file is located in:
<clientconfigdir>/
"""
return os.path.join(clientconfigdir, name)
def find_config_server(name):
"""A server configuration file is located in:
<serverconfigdir>/
"""
return os.path.join(serverconfigdir, name)
def find_doc(name):
"""A documentation file may be located in:
<sharedir>/doc/pybridge/ (installed)
<basedir>/ (source)
"""
if sharedir == basedir:
return os.path.join(basedir, name)
else:
return os.path.join(sharedir, 'doc', 'pybridge', name)
def find_glade(name):
"""A Glade interface file may be located in:
<sharedir>/pybridge/glade/ (installed)
<basedir>/glade/ (source)
"""
if sharedir == basedir:
return os.path.join(basedir, 'glade', name)
else:
return os.path.join(sharedir, 'pybridge', 'glade', name)
def find_pixmap(name):
"""A pixmap file may be located in:
<sharedir>/pybridge/pixmaps/ (installed)
<basedir>/pixmaps/ (source)
"""
if sharedir == basedir:
return os.path.join(basedir, 'pixmaps', name)
else:
return os.path.join(sharedir, 'pybridge', 'pixmaps', name)
def get_localedir():
"""Returns the path of the locale directory."""
return os.path.join(sharedir, 'locale')
|