Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 380943 | Differences between
and this patch

Collapse All | Expand All

(-)a/setup.py (-26 / +26 lines)
Lines 11-48 from distutils.command.install_data import install_data Link Here
11
from distutils.log import warn, info, error, fatal
11
from distutils.log import warn, info, error, fatal
12
from distutils.dep_util import newer
12
from distutils.dep_util import newer
13
13
14
# Get current Python version
14
PO_DIR = 'po'
15
python_version = platform.python_version_tuple()
15
MO_DIR = os.path.join('build', 'mo')
16
16
17
# Setup the default install prefix
17
class BuildData(build):
18
prefix = sys.prefix
19
18
20
# Check our python is version 2.6 or higher
19
    user_options = [
21
if python_version[0] >= 2 and python_version[1] >= 6:
20
        ('prefix=', None, "installation prefix"),
22
    ## Set file location prefix accordingly
21
        ]
23
    prefix = '/usr/local'
24
22
25
# Get the install prefix if one is specified from the command line
23
    def initialize_options(self):
26
for arg in sys.argv:
24
        build.initialize_options(self)
27
    if arg.startswith('--prefix='):
25
        self.prefix = None
28
        prefix = arg[9:]
29
        prefix = os.path.expandvars(prefix)
30
26
31
# Gen .in files with @PREFIX@ replaced
27
    def finalize_options(self):
32
for filename in ['udev-discover']:
28
        build.finalize_options(self)
33
    infile = open(filename + '.in', 'r')
29
        if not self.prefix:
34
    data = infile.read().replace('@PREFIX@', prefix)
30
            install = self.distribution.get_command_obj('install', False)
35
    infile.close()
31
            if install:
32
                self.prefix = install.prefix
33
            else:
34
                self.prefix = sys.prefix
36
35
37
    outfile = open(filename, 'w')
36
    def run (self):
38
    outfile.write(data)
37
        # Gen .in files with @PREFIX@ replaced
39
    outfile.close()
38
        for filename in ['udev-discover']:
39
            infile = open(filename + '.in', 'r')
40
            data = infile.read().replace('@PREFIX@', self.prefix)
41
            infile.close()
40
42
41
PO_DIR = 'po'
43
            outfile = open(filename, 'w')
42
MO_DIR = os.path.join('build', 'mo')
44
            outfile.write(data)
45
            outfile.close()
43
46
44
class BuildData(build):
45
    def run (self):
46
        build.run (self)
47
        build.run (self)
47
48
48
        for po in glob.glob (os.path.join (PO_DIR, '*.po')):
49
        for po in glob.glob (os.path.join (PO_DIR, '*.po')):
49
- 

Return to bug 380943