pygame is sharing code with you
Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.
Don't show this againpygame / setup.py
- Tag
- 0.06
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 | #!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id:$'
import os
from os.path import join, abspath, dirname, splitext
import sys
import subprocess
from distutils.core import setup
from distutils.cmd import Command
# A "do-everything" command class for building any type of documentation.
class BuildDocCommand(Command):
user_options = [('doc-dir=', None, 'directory to build documentation'),
('epydoc=', None, 'epydoc executable'),
('rest-latex=', None, 'ReST LaTeX writer executable'),
('rest-html=', None, 'ReST HTML writer executable'),
('mkhowto=', None, 'Python mkhowto executable')]
def initialize_options(self):
self.doc_dir = join(abspath(dirname(sys.argv[0])), 'doc')
self.epydoc = 'epydoc'
self.rest_latex = 'python_latex.py'
self.rest_html = 'rst2html.py'
self.mkhowto = 'mkhowto'
def finalize_options(self):
pass
def run(self):
if 'pre' in self.doc:
subprocess.call(self.doc['pre'], shell=True)
prev_dir = os.getcwd()
if 'chdir' in self.doc:
dir = abspath(join(self.doc_dir, self.doc['chdir']))
try:
os.makedirs(dir)
except:
pass
os.chdir(dir)
if 'epydoc_packages' in self.doc:
cmd = [self.epydoc,
'--no-private',
'--html',
'--no-sourcecode',
'--url=http://www.pygame.org',
'-v']
cmd.append('--name="%s"' % self.doc['description'])
if 'epydoc_dir' in self.doc:
cmd.append('-o %s' % \
abspath(join(self.doc_dir, self.doc['epydoc_dir'])))
cmd.append(self.doc['epydoc_packages'])
subprocess.call(' '.join(cmd), shell=True)
if 'rest_howto' in self.doc:
txtfile = abspath(join(self.doc_dir, self.doc['rest_howto']))
texfile = '%s.tex' % splitext(txtfile)[0]
cmd = [self.rest_latex,
txtfile,
'>',
texfile]
subprocess.call(' '.join(cmd), shell=True)
cmd = [self.mkhowto,
'--split=4',
texfile]
subprocess.call(' '.join(cmd), shell=True)
if 'rest_html' in self.doc:
txtfile = abspath(join(self.doc_dir, self.doc['rest_html']))
htmlfile = '%s.html' % splitext(txtfile)[0]
cmd = [self.rest_html,
txtfile,
'>',
htmlfile]
subprocess.call(' '.join(cmd), shell=True)
os.chdir(prev_dir)
# Fudge a command class given a dictionary description
def make_doc_command(**kwargs):
class c(BuildDocCommand):
doc = dict(**kwargs)
description = 'build %s' % doc['description']
c.__name__ = 'build_doc_%s' % c.doc['name'].replace('-', '_')
return c
# This command does nothing but run all the other doc commands.
# (sub_commands are set later)
class BuildAllDocCommand(Command):
description = 'build all documentation'
user_options = []
sub_commands = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
for cmd_name in self.get_sub_commands():
self.run_command(cmd_name)
extra_cmds = {
'build_doc_sdl_api': make_doc_command(
name='sdl-api',
description='SDL-ctypes API documentation',
chdir='.build-doc',
pre='python support/prep_doc_sdl.py doc/.build-doc',
epydoc_dir='sdl-api',
epydoc_packages='SDL'),
'build_doc_pygame_api': make_doc_command(
name='pygame-api',
description='Pygame-ctypes API',
chdir='.build-doc',
pre='python support/prep_doc_pygame.py doc/.build-doc',
epydoc_dir='pygame-api',
epydoc_packages='pygame'),
'build_doc_sdl_manual': make_doc_command(
name='sdl-manual',
description='SDL-ctypes manual',
chdir='',
rest_howto='sdl-manual.txt'),
'build_doc_index': make_doc_command(
name='index',
description='documentation index',
chdir='',
rest_html='index.txt'),
'build_doc': BuildAllDocCommand
}
for name in extra_cmds.keys():
if name != 'build_doc':
BuildAllDocCommand.sub_commands.append((name, None))
setup(
name='pygame-ctypes',
version='0.06',
description='Python game and multimedia package',
author='Alex Holkner',
author_email='aholkner@cs.rmit.edu.au',
url='http://www.pygame.org/ctypes',
license='LGPL',
cmdclass=extra_cmds,
packages=['SDL', 'pygame'],
)
|