/usr/share/pyshared/freevo/util/plugindistutils.py is in python-freevo 1.9.2b2-4.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 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | # -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# Freevo distutils for installing plug-ins
# -----------------------------------------------------------------------
# $Id: plugindistutils.py 11780 2011-01-07 23:06:16Z adam $
#
# Notes:
# If you want to create a package with a plug-in, you have to rebuild
# the freevo directory structure. E.g. if you have a video plug-in and
# an image for it, you should have the following structure:
#
# root
# |--> setup.py
# |
# |--> share
# | |--> images
# | | |--> file.jpg
# |
# |--> src
# | |--> video
# | | |--> plugins
# | | | |--> __init__.py (empty)
# | | | |--> plugin.py
#
#
# The setup.py file should look like this:
#
# | #!/usr/bin/env python
# |
# | """Setup script for my freevo plug-in."""
# |
# |
# | __revision__ = "$Id: plugindistutils.py 11780 2011-01-07 23:06:16Z adam $"
# |
# | from distutils.core import setup, Extension
# | import distutils.command.install
# | from freevo.util.plugindistutils import *
# |
# | # now start the python magic
# | setup (name = "nice_plugin",
# | version = '0.1',
# | description = "My first plug-in",
# | author = "me",
# | author_email = "my@mail.address",
# | url = "http://i-also-have-a-web.address",
# |
# | package_dir = package_dir,
# | packages = packages,
# | data_files = data_files
# | )
# | finalize()
#
#
# To auto-build distribution packages, a MANIFEST.in is helpful. You should
# create one, e.g.
#
# | recursive-include src *.py
# | recursive-include share *
# | include *
#
#
# If you need help, please join the freevo developer mailing list
#
#
# Todo:
#
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
# 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 MER-
# CHANTABILITY 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.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -----------------------------------------------------------------------
import os
import sys
try:
import freevo.version as version
import freevo.revision as revision
except:
import version
import revision
def package_finder(result, dirname, names):
"""
os.path.walk helper for 'src'
"""
for name in names:
if os.path.splitext(name)[1] == '.py':
import_name = dirname.replace('/','.').replace('..src', 'freevo')
result[import_name] = dirname
return result
return result
def data_finder(result, dirname, names):
"""
os.path.walk helper for data directories
"""
files = []
for name in names:
if os.path.isfile(os.path.join(dirname, name)):
if dirname.find('i18n') == -1 or (name.find('pot') == -1 and \
name.find('update.py') == -1):
files.append(os.path.join(dirname, name))
if files and dirname.find('/.svn') == -1:
result.append((dirname.replace('./share', 'share/freevo').
replace('./src/www', 'share/freevo').\
replace('./i18n', 'share/locale').\
replace('./contrib', 'share/freevo/contrib').\
replace('./Docs', 'share/doc/freevo-%s' % version.__version__).\
replace('./helpers', 'share/freevo/helpers'), files))
return result
def docbook_finder(result, dirname, names):
"""
os.path.walk helper for docbook data files in Docs
"""
files = []
for name in names:
if os.path.splitext(name)[1] == '.html':
files.append(os.path.join(dirname, name))
if files and dirname.find('/.svn') == -1:
result.append((dirname.replace('/html', ''). \
replace('./Docs', 'share/doc/freevo-%s' % version.__version__), files))
return result
def check_libs(libs):
"""
check for python libs installed
"""
if len(sys.argv) > 1 and sys.argv[1].lower() == 'install':
# check for needed libs
for module, url in libs:
print 'checking for %-13s' % (module+'...'),
try:
exec('import %s' % module)
print 'found'
except:
print 'not found'
print 'please download it from %s and install it' % url
sys.exit(1)
def i18n(application):
"""
i18n cmd support
"""
global use_i18n
use_i18n = 1
# cmd == '18n'
if len(sys.argv) > 1 and sys.argv[1].lower() == 'i18n':
if len(sys.argv) > 2 and sys.argv[2].lower() == '--help':
print 'Updates the i18n translation. This includes generating the pot'
print 'file, merging the pot file into the po files and generate the'
print 'mo files from them.'
print
print 'Options for \'i18n\' command:'
print ' --no-merge don\'t merge pot file into po files'
print
sys.exit(0)
# arg i18n will update the pot file and maybe merge the po files
print 'updating pot file'
# for freevo main package: remember the skin settings
if application == 'freevo':
f = open('i18n/freevo.pot')
fxd_strings = []
add = 0
for line in f.readlines():
if line.find('Manualy added from fxd skin files') > 0:
add = 1
if add:
fxd_strings.append(line)
f.close()
os.system('(cd src ; find . -name \*.py | xargs xgettext -o ../i18n/%s.pot)' % \
application)
# for freevo main package: restore the skin settings
if application == 'freevo':
f = open('i18n/freevo.pot', 'a')
for line in fxd_strings:
f.write(line)
f.close()
# if arg 2 is not --no-merge to the merge
if not (len(sys.argv) > 2 and sys.argv[2] == '--no-merge'):
for file in ([ os.path.join('i18n', fname) for fname in os.listdir('i18n') ]):
if os.path.isdir(file) and file.find('.svn') == -1:
print 'updating %s...' % file,
sys.stdout.flush()
file = os.path.join(file, 'LC_MESSAGES/%s.po' % application)
os.system('msgmerge --update --backup=off %s i18n/%s.pot' % \
(file, application))
print
# do not run this function if --help is given
for a in sys.argv:
if a.lower() == '--help':
return
# generate mo files for 'i18n', 'sdist' and 'bdist_rpm'
if len(sys.argv) > 1 and sys.argv[1].lower() in ('i18n', 'sdist', 'bdist_rpm'):
# update the mo files
print 'updating mo files'
for file in ([ os.path.join('i18n', fname) for fname in os.listdir('i18n') ]):
if os.path.isdir(file) and file.find('.svn') == -1:
file = os.path.join(file, 'LC_MESSAGES/%s.po' % application)
mo = os.path.splitext(file)[0] + '.mo'
os.system('msgfmt -o %s %s' % (mo, file))
# exit for cmd == 'i18n'
if len(sys.argv) > 1 and sys.argv[1].lower() == 'i18n':
sys.exit(0)
def finalize():
"""
some stuff after set-up is finished
"""
global use_i18n
if use_i18n and len(sys.argv) > 1 and sys.argv[1].lower() == '--help-commands':
print 'Special Commands for Freevo:'
print ' i18n i18n help functions'
print
# use i18n command option
use_i18n = 0
# create list of source files
package_dir = {}
os.path.walk('./src', package_finder, package_dir)
packages = []
for p in package_dir:
packages.append(p)
# create list of data files (share)
data_files = []
os.path.walk('./share', data_finder, data_files)
os.path.walk('./contrib/fbcon', data_finder, data_files)
os.path.walk('./contrib/xmltv', data_finder, data_files)
os.path.walk('./src/www/htdocs', data_finder, data_files)
os.path.walk('./i18n', data_finder, data_files)
|