Skip to content

Commit 179d4d8

Browse files
committed
Preparation for libsass3.2
1 parent 83bd0ba commit 179d4d8

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
@@ -417,27 +417,26 @@ PySass_compile_string(PyObject *self, PyObject *args) {
417417
struct Sass_Context *ctx;
418418
struct Sass_Data_Context *context;
419419
struct Sass_Options *options;
420-
char *string, *include_paths, *image_path;
420+
char *string, *include_paths;
421421
const char *error_message, *output_string;
422422
Sass_Output_Style output_style;
423423
int source_comments, error_status, precision;
424424
PyObject *custom_functions;
425425
PyObject *result;
426426

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

435-
context = sass_make_data_context(string);
435+
context = sass_make_data_context(strdup(string));
436436
options = sass_data_context_get_options(context);
437437
sass_option_set_output_style(options, output_style);
438438
sass_option_set_source_comments(options, source_comments);
439439
sass_option_set_include_path(options, include_paths);
440-
sass_option_set_image_path(options, image_path);
441440
sass_option_set_precision(options, precision);
442441
_add_custom_functions(options, custom_functions);
443442

@@ -461,16 +460,16 @@ PySass_compile_filename(PyObject *self, PyObject *args) {
461460
struct Sass_Context *ctx;
462461
struct Sass_File_Context *context;
463462
struct Sass_Options *options;
464-
char *filename, *include_paths, *image_path;
463+
char *filename, *include_paths;
465464
const char *error_message, *output_string, *source_map_string;
466465
Sass_Output_Style output_style;
467466
int source_comments, error_status, precision;
468467
PyObject *source_map_filename, *custom_functions, *result;
469468

470469
if (!PyArg_ParseTuple(args,
471-
PySass_IF_PY3("yiiyyiOO", "siissiOO"),
470+
PySass_IF_PY3("yiiyiOO", "siisiOO"),
472471
&filename, &output_style, &source_comments,
473-
&include_paths, &image_path, &precision,
472+
&include_paths, &precision,
474473
&source_map_filename, &custom_functions)) {
475474
return NULL;
476475
}
@@ -493,7 +492,6 @@ PySass_compile_filename(PyObject *self, PyObject *args) {
493492
sass_option_set_output_style(options, output_style);
494493
sass_option_set_source_comments(options, source_comments);
495494
sass_option_set_include_path(options, include_paths);
496-
sass_option_set_image_path(options, image_path);
497495
sass_option_set_precision(options, precision);
498496
_add_custom_functions(options, custom_functions);
499497

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)