|
8 | 8 | import os
|
9 | 9 | import os.path
|
10 | 10 | import platform
|
11 |
| -import re |
12 | 11 | import shutil
|
13 | 12 | import sys
|
14 | 13 | import tempfile
|
|
23 | 22 |
|
24 | 23 | LIBSASS_DIR = 'libsass'
|
25 | 24 |
|
26 |
| -MAKEFILE_SOURCES_LIST_RE = re.compile(r''' |
27 |
| - (?: ^ | \n ) (?: libsass_la_ )? SOURCES [ \t]* = [ \t]* |
28 |
| - (?P<sources> (?: (?: $ | [ \t] | \\ [\n] )+ |
29 |
| - [^ \n\t\\]+ )+ ) |
30 |
| -''', re.VERBOSE) |
31 |
| - |
32 | 25 |
|
33 | 26 | if not os.path.isfile(os.path.join(LIBSASS_DIR, 'Makefile')) and \
|
34 | 27 | os.path.isdir('.git'):
|
|
38 | 31 | print(' git submodule update --init', file=sys.stderr)
|
39 | 32 | print(file=sys.stderr)
|
40 | 33 |
|
41 |
| -libsass_sources = set() |
42 |
| -for makefilename in [ |
43 |
| - os.path.join(LIBSASS_DIR, 'Makefile'), |
44 |
| - os.path.join(LIBSASS_DIR, 'Makefile.am')]: |
45 |
| - with open(makefilename) as makefile: |
46 |
| - sources_match = MAKEFILE_SOURCES_LIST_RE.search(makefile.read()) |
47 |
| - sources_list = sources_match.group('sources').replace('\\\n', ' ') |
48 |
| - libsass_sources.update(sources_list.split()) |
49 |
| -libsass_sources = set( |
50 |
| - x for x in libsass_sources if not x.endswith('.hpp') and not x.endswith('.h') |
51 |
| -) |
52 |
| - |
53 |
| -libsass_headers = [ |
54 |
| - os.path.join(LIBSASS_DIR, 'sass_interface.h'), |
55 |
| - os.path.join(LIBSASS_DIR, 'sass.h'), |
56 |
| - os.path.join(LIBSASS_DIR, 'win32', 'unistd.h'), |
57 |
| -] |
58 |
| -libsass_headers.extend(glob.glob('*.hpp')) |
59 |
| -include_dirs = ['b64', 'utf8'] |
60 |
| -sources = ['pysass.cpp'] |
61 |
| -sources.extend([os.path.join(LIBSASS_DIR, s) for s in libsass_sources]) |
| 34 | +libsass_files = os.listdir(LIBSASS_DIR) |
| 35 | +libsass_sources = [f for f in libsass_files if f.endswith(('.c', '.cpp'))] |
| 36 | +libsass_headers = [f for f in libsass_files if f.endswith(('.h', '.hpp'))] |
| 37 | +headers = [os.path.join(LIBSASS_DIR, f) for f in libsass_headers] |
| 38 | +sources = [os.path.join(LIBSASS_DIR, f) for f in libsass_sources] |
| 39 | +sources.append('pysass.cpp') |
62 | 40 |
|
63 | 41 | if sys.platform == 'win32':
|
64 | 42 | from distutils.msvc9compiler import get_build_version
|
|
0 commit comments