Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 103036
Collapse All | Expand All

(-)PyX-0.8.1/pyx/siteconfig.py (-35 / +3 lines)
Lines 1-36 Link Here
1
#!/usr/bin/env python
1
lfsdir = "/usr/share/pyx"
2
# -*- coding: ISO-8859-1 -*-
2
sharedir = "/usr/share/pyx"
3
#
3
pyxrcdir = "/etc/pyxrc"
4
#
5
# Copyright (C) 2004-2005 André Wobst <wobsta@users.sourceforge.net>
6
#
7
# This file is part of PyX (http://pyx.sourceforge.net/).
8
#
9
# PyX is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2 of the License, or
12
# (at your option) any later version.
13
#
14
# PyX is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with PyX; if not, write to the Free Software
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
22
23
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
24
# This file configures PyX search paths relative to the current
25
# position, e.g. for local usage. When installing PyX via distutils
26
# the contents of this file is not copied to the PyX installation.
27
# Instead the correct information about the paths from the installation
28
# process are used.
29
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
30
31
import os
32
33
lfsdir = os.path.join(os.path.dirname(__file__), "lfs")
34
sharedir = os.path.join(os.path.dirname(__file__), "..", "contrib")
35
pyxrcdir = os.path.join(os.path.dirname(__file__), "..")
36
4
(-)PyX-0.8.1/pyx/siteconfig.py.orig (+36 lines)
Line 0 Link Here
1
#!/usr/bin/env python
2
# -*- coding: ISO-8859-1 -*-
3
#
4
#
5
# Copyright (C) 2004-2005 André Wobst <wobsta@users.sourceforge.net>
6
#
7
# This file is part of PyX (http://pyx.sourceforge.net/).
8
#
9
# PyX is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2 of the License, or
12
# (at your option) any later version.
13
#
14
# PyX is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with PyX; if not, write to the Free Software
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
22
23
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
24
# This file configures PyX search paths relative to the current
25
# position, e.g. for local usage. When installing PyX via distutils
26
# the contents of this file is not copied to the PyX installation.
27
# Instead the correct information about the paths from the installation
28
# process are used.
29
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
30
31
import os
32
33
lfsdir = os.path.join(os.path.dirname(__file__), "lfs")
34
sharedir = os.path.join(os.path.dirname(__file__), "..", "contrib")
35
pyxrcdir = os.path.join(os.path.dirname(__file__), "..")
36
(-)PyX-0.8.1/setup.py (-81 lines)
Lines 77-160 Link Here
77
# we put the global pyxrc into the share directory as well.
77
# we put the global pyxrc into the share directory as well.
78
adddatafiles("pyxrcdir", os.name != "nt" and "/etc" or "share/pyx", ["pyxrc"])
78
adddatafiles("pyxrcdir", os.name != "nt" and "/etc" or "share/pyx", ["pyxrc"])
79
79
80
################################################################################
81
# extend install commands to overwrite siteconfig.py during build and install
82
#
83
84
85
class pyx_build_py(build_py):
86
87
    def build_module(self, module, module_file, package):
88
        if package == "pyx" and module == "siteconfig":
89
            # generate path information as the original build_module does it
90
            outfile = self.get_module_outfile(self.build_lib, [package], module)
91
            outdir = os.path.dirname(outfile)
92
            self.mkpath(outdir)
93
94
            if log:
95
                log.info("creating proper %s" % outfile)
96
97
            # create the additional relative path parts to be inserted into the
98
            # os.path.join methods in the original siteconfig.py
99
            indir = os.path.dirname(module_file)
100
            addjoinstring = ", ".join(["'..'" for d in outdir.split(os.path.sep)] +
101
                                      ["'%s'" % d for d in indir.split(os.path.sep)])
102
103
            # write a modifed version of siteconfig.py
104
            fin = open(module_file, "r")
105
            fout = open(outfile, "w")
106
            for line in fin.readlines():
107
                fout.write(line.replace("os.path.join(os.path.dirname(__file__), ",
108
                                        "os.path.join(os.path.dirname(__file__), %s, " % addjoinstring))
109
            fin.close()
110
            fout.close()
111
        else:
112
            return build_py.build_module(self, module, module_file, package)
113
114
115
class pyx_install_data(install_data):
116
117
    def run(self):
118
        self.siteconfiglines = []
119
        for dir, files in self.data_files:
120
            # append siteconfiglines by "<siteconfigname> = <dir>"
121
122
            # get the install directory
123
            # (the following four lines are copied from within the install_data.run loop)
124
            dir = convert_path(dir)
125
            if not os.path.isabs(dir):
126
                dir = os.path.join(self.install_dir, dir)
127
            elif self.root:
128
                dir = change_root(self.root, dir)
129
130
            self.siteconfiglines.append("%s = '%s'\n" % (siteconfignames[files], dir))
131
132
        install_data.run(self)
133
134
135
class pyx_install_lib(install_lib):
136
137
    def run(self):
138
        # siteconfig.py depends on install_data:
139
        self.run_command('install_data')
140
        install_lib.run(self)
141
142
    def install(self):
143
        # first we perform the tree_copy
144
        result = install_lib.install(self)
145
146
        # siteconfiglines have been created by install_data
147
        siteconfiglines = self.distribution.command_obj["install_data"].siteconfiglines
148
149
        # such that we can easily overwrite siteconfig.py
150
        outfile = os.path.join(self.install_dir, "pyx", "siteconfig.py")
151
        if log:
152
            log.info("creating proper %s" % outfile)
153
        f = open(outfile, "w")
154
        f.writelines(siteconfiglines)
155
        f.close()
156
157
        return result
158
80
159
################################################################################
81
################################################################################
160
# additional package metadata (only available in Python 2.3 and above)
82
# additional package metadata (only available in Python 2.3 and above)
Lines 193-199 Link Here
193
      packages=["pyx", "pyx/graph", "pyx/graph/axis", "pyx/t1strip", "pyx/pykpathsea"],
115
      packages=["pyx", "pyx/graph", "pyx/graph/axis", "pyx/t1strip", "pyx/pykpathsea"],
194
      ext_modules=ext_modules,
116
      ext_modules=ext_modules,
195
      data_files=data_files,
117
      data_files=data_files,
196
      cmdclass = {"build_py": pyx_build_py,
197
                  "install_data": pyx_install_data,
198
                  "install_lib": pyx_install_lib},
199
      **addargs)
118
      **addargs)

Return to bug 103036