Skip to content

Commit 2558448

Browse files
committed
Merge pull request #45 from asottile/minor_cleanup
A little cleanup in setup.py
2 parents 1353f25 + 1740aaa commit 2558448

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

setup.py

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import os
99
import os.path
1010
import platform
11-
import re
1211
import shutil
1312
import sys
1413
import tempfile
@@ -23,12 +22,6 @@
2322

2423
LIBSASS_DIR = 'libsass'
2524

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-
3225

3326
if not os.path.isfile(os.path.join(LIBSASS_DIR, 'Makefile')) and \
3427
os.path.isdir('.git'):
@@ -38,27 +31,12 @@
3831
print(' git submodule update --init', file=sys.stderr)
3932
print(file=sys.stderr)
4033

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')
6240

6341
if sys.platform == 'win32':
6442
from distutils.msvc9compiler import get_build_version

0 commit comments

Comments
 (0)