~sirver/spasm/trunk

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Holger Rapp
  • Date: 2009-06-05 16:11:55 UTC
  • Revision ID: sirver@kallisto.local-20090605161155-7jhnq111piq1drxr
Enhanced setup.py a bit. Tables are now only generated when explicitly requested

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
from distutils.core import setup, Extension
13
13
from distutils.command.install import INSTALL_SCHEMES
 
14
from distutils.command.build_py import build_py as _build_py
14
15
 
15
16
import sys, string, os
16
17
import shutil
20
21
from glob import glob
21
22
from SPASM._parser._yacc_parser import _YaccParser
22
23
 
23
 
def _compile_yacc_table():
24
 
    for f in glob("SPASM/_parser/_yacc_cache*"):
25
 
        os.unlink(f)
 
24
 
 
25
class SPASM_build_py(_build_py):
 
26
 
 
27
    def _compile_yacc_table(self):
 
28
        for f in glob("SPASM/_parser/_yacc_cache*"):
 
29
            os.unlink(f)
 
30
        
 
31
        cache = "SPASM._parser._yacc_cache"
 
32
        yacc(module=_YaccParser,tabmodule=cache, outputdir='SPASM/_parser')
26
33
    
27
 
    cache = "SPASM._parser._yacc_cache"
28
 
    yacc(module=_YaccParser,tabmodule=cache, outputdir='SPASM/_parser')
 
34
    def run(self):
 
35
        self._compile_yacc_table()
29
36
 
30
 
_compile_yacc_table()
 
37
        _build_py.run(self)
31
38
 
32
39
# Install data files (header) into the same directory
33
40
# as the assembler
34
41
for scheme in INSTALL_SCHEMES.values():
35
 
    print scheme
36
42
    scheme['data'] = scheme['purelib']
37
43
 
38
44
desc = """This program is a python only attempt to bring the marvels of
56
62
    # package_dir      = {'': 'SPASM'},
57
63
    data_files = [("header", glob("header/*.inc") )],
58
64
    scripts = ("spasm.py",),
 
65
 
 
66
    cmdclass = { 'build_py': SPASM_build_py, },
59
67
)
60
68
 
61
69