Skip to content

Commit 0ff0e0e

Browse files
committed
Merge pull request #52 from asottile/libsass_32
Preparation for libsass3.2
2 parents 4023e3d + 179d4d8 commit 0ff0e0e

File tree

5 files changed

+83
-118
lines changed

5 files changed

+83
-118
lines changed

libsass

Submodule libsass updated 104 files

pysass.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -415,27 +415,26 @@ PySass_compile_string(PyObject *self, PyObject *args) {
415415
struct Sass_Context *ctx;
416416
struct Sass_Data_Context *context;
417417
struct Sass_Options *options;
418-
char *string, *include_paths, *image_path;
418+
char *string, *include_paths;
419419
const char *error_message, *output_string;
420420
Sass_Output_Style output_style;
421421
int source_comments, error_status, precision;
422422
PyObject *custom_functions;
423423
PyObject *result;
424424

425425
if (!PyArg_ParseTuple(args,
426-
PySass_IF_PY3("yiiyyiO", "siissiO"),
426+
PySass_IF_PY3("yiiyiO", "siisiO"),
427427
&string, &output_style, &source_comments,
428-
&include_paths, &image_path, &precision,
428+
&include_paths, &precision,
429429
&custom_functions)) {
430430
return NULL;
431431
}
432432

433-
context = sass_make_data_context(string);
433+
context = sass_make_data_context(strdup(string));
434434
options = sass_data_context_get_options(context);
435435
sass_option_set_output_style(options, output_style);
436436
sass_option_set_source_comments(options, source_comments);
437437
sass_option_set_include_path(options, include_paths);
438-
sass_option_set_image_path(options, image_path);
439438
sass_option_set_precision(options, precision);
440439
_add_custom_functions(options, custom_functions);
441440

@@ -459,16 +458,16 @@ PySass_compile_filename(PyObject *self, PyObject *args) {
459458
struct Sass_Context *ctx;
460459
struct Sass_File_Context *context;
461460
struct Sass_Options *options;
462-
char *filename, *include_paths, *image_path;
461+
char *filename, *include_paths;
463462
const char *error_message, *output_string, *source_map_string;
464463
Sass_Output_Style output_style;
465464
int source_comments, error_status, precision;
466465
PyObject *source_map_filename, *custom_functions, *result;
467466

468467
if (!PyArg_ParseTuple(args,
469-
PySass_IF_PY3("yiiyyiOO", "siissiOO"),
468+
PySass_IF_PY3("yiiyiOO", "siisiOO"),
470469
&filename, &output_style, &source_comments,
471-
&include_paths, &image_path, &precision,
470+
&include_paths, &precision,
472471
&source_map_filename, &custom_functions)) {
473472
return NULL;
474473
}
@@ -491,7 +490,6 @@ PySass_compile_filename(PyObject *self, PyObject *args) {
491490
sass_option_set_output_style(options, output_style);
492491
sass_option_set_source_comments(options, source_comments);
493492
sass_option_set_include_path(options, include_paths);
494-
sass_option_set_image_path(options, image_path);
495493
sass_option_set_precision(options, precision);
496494
_add_custom_functions(options, custom_functions);
497495

sass.py

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def __str__(self):
144144

145145
def compile_dirname(
146146
search_path, output_path, output_style, source_comments, include_paths,
147-
image_path, precision, custom_functions,
147+
precision, custom_functions,
148148
):
149149
fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
150150
for dirpath, _, filenames in os.walk(search_path):
@@ -159,7 +159,7 @@ def compile_dirname(
159159
input_filename = input_filename.encode(fs_encoding)
160160
s, v, _ = compile_filename(
161161
input_filename, output_style, source_comments, include_paths,
162-
image_path, precision, None, custom_functions,
162+
precision, None, custom_functions,
163163
)
164164
if s:
165165
v = v.decode('UTF-8')
@@ -192,8 +192,6 @@ def compile(**kwargs):
192192
:param include_paths: an optional list of paths to find ``@import``\ ed
193193
SASS/CSS source files
194194
:type include_paths: :class:`collections.Sequence`, :class:`str`
195-
:param image_path: an optional path to find images
196-
:type image_path: :class:`str`
197195
:param precision: optional precision for numbers. :const:`5` by default.
198196
:type precision: :class:`int`
199197
:param custom_functions: optional mapping of custom functions.
@@ -229,8 +227,6 @@ def compile(**kwargs):
229227
:param include_paths: an optional list of paths to find ``@import``\ ed
230228
SASS/CSS source files
231229
:type include_paths: :class:`collections.Sequence`, :class:`str`
232-
:param image_path: an optional path to find images
233-
:type image_path: :class:`str`
234230
:param precision: optional precision for numbers. :const:`5` by default.
235231
:type precision: :class:`int`
236232
:param custom_functions: optional mapping of custom functions.
@@ -269,8 +265,6 @@ def compile(**kwargs):
269265
:param include_paths: an optional list of paths to find ``@import``\ ed
270266
SASS/CSS source files
271267
:type include_paths: :class:`collections.Sequence`, :class:`str`
272-
:param image_path: an optional path to find images
273-
:type image_path: :class:`str`
274268
:param precision: optional precision for numbers. :const:`5` by default.
275269
:type precision: :class:`int`
276270
:param custom_functions: optional mapping of custom functions.
@@ -424,16 +418,6 @@ def func_name(a, b):
424418
'Windows) string, not ' + repr(include_paths))
425419
if isinstance(include_paths, text_type):
426420
include_paths = include_paths.encode(fs_encoding)
427-
try:
428-
image_path = kwargs.pop('image_path')
429-
except KeyError:
430-
image_path = b'.'
431-
else:
432-
if not isinstance(image_path, string_types):
433-
raise TypeError('image_path must be a string, not ' +
434-
repr(image_path))
435-
elif isinstance(image_path, text_type):
436-
image_path = image_path.encode(fs_encoding)
437421

438422
custom_functions = kwargs.pop('custom_functions', ())
439423
if isinstance(custom_functions, collections.Mapping):
@@ -460,10 +444,10 @@ def func_name(a, b):
460444
string = kwargs.pop('string')
461445
if isinstance(string, text_type):
462446
string = string.encode('utf-8')
463-
s, v = compile_string(string,
464-
output_style, source_comments,
465-
include_paths, image_path, precision,
466-
custom_functions)
447+
s, v = compile_string(
448+
string, output_style, source_comments, include_paths, precision,
449+
custom_functions,
450+
)
467451
if s:
468452
return v.decode('utf-8')
469453
elif 'filename' in modes:
@@ -475,10 +459,8 @@ def func_name(a, b):
475459
elif isinstance(filename, text_type):
476460
filename = filename.encode(fs_encoding)
477461
s, v, source_map = compile_filename(
478-
filename,
479-
output_style, source_comments,
480-
include_paths, image_path, precision, source_map_filename,
481-
custom_functions,
462+
filename, output_style, source_comments, include_paths, precision,
463+
source_map_filename, custom_functions,
482464
)
483465
if s:
484466
v = v.decode('utf-8')
@@ -522,10 +504,8 @@ def func_name(a, b):
522504
raise ValueError('dirname must be a pair of (source_dir, '
523505
'output_dir)')
524506
s, v = compile_dirname(
525-
search_path, output_path,
526-
output_style, source_comments,
527-
include_paths, image_path, precision,
528-
custom_functions,
507+
search_path, output_path, output_style, source_comments,
508+
include_paths, precision, custom_functions,
529509
)
530510
if s:
531511
return

sassc.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
Optional directory path to find ``@import``\ ed (S)CSS files.
2222
Can be multiply used.
2323
24-
.. option:: -i <dir>, --image-path <dir>
25-
26-
Path to find images. Default is the current directory (:file:`./`).
27-
2824
.. option:: -m, -g, --sourcemap
2925
3026
Emit source map. Requires the second argument (output CSS filename).
@@ -88,8 +84,6 @@ def main(argv=sys.argv, stdout=sys.stdout, stderr=sys.stderr):
8884
dest='include_paths', action='append',
8985
help='Path to find "@import"ed (S)CSS source files. '
9086
'Can be multiply used.')
91-
parser.add_option('-i', '--image-path', metavar='DIR', default='./',
92-
help='Path to find images. [default: %default]')
9387
parser.add_option('-w', '--watch', action='store_true',
9488
help='Watch file for changes. Requires the second '
9589
'argument (output css filename).')
@@ -130,7 +124,6 @@ def main(argv=sys.argv, stdout=sys.stdout, stderr=sys.stderr):
130124
output_style=options.output_style,
131125
source_map_filename=source_map_filename,
132126
include_paths=options.include_paths,
133-
image_path=options.image_path,
134127
precision=options.precision
135128
)
136129
else:
@@ -140,7 +133,6 @@ def main(argv=sys.argv, stdout=sys.stdout, stderr=sys.stderr):
140133
filename=filename,
141134
output_style=options.output_style,
142135
include_paths=options.include_paths,
143-
image_path=options.image_path,
144136
precision=options.precision
145137
)
146138
except (IOError, OSError) as e:

0 commit comments

Comments
 (0)