Giter VIP home page Giter VIP logo

libsass-python's Introduction

Sass

@SassCSS on Twitter    stackoverflow    Gitter

Sass makes CSS fun again. Sass is an extension of CSS, adding nested rules, variables, mixins, selector inheritance, and more. It's translated to well-formatted, standard CSS using the command line tool or a plugin for your build system.

$font-stack: Helvetica, sans-serif;
$primary-color: #333;

body {
  font: 100% $font-stack;
  color: $primary-color;
}

@mixin border-radius($radius) {
  -webkit-border-radius: $radius;
     -moz-border-radius: $radius;
      -ms-border-radius: $radius;
          border-radius: $radius;
}

nav {
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li { @include border-radius(10px); }

  a {
    display: block;
    padding: 6px 12px;
    text-decoration: none;
  }
}

Install Sass

You can install Sass on Windows, Mac, or Linux by downloading the package for your operating system from GitHub and adding it to your PATH. That's all—there are no external dependencies and nothing else you need to install.

If you use Node.js, you can also install Sass using npm by running

npm install -g sass

However, please note that this will install the pure JavaScript implementation of Sass, which runs somewhat slower than the other options listed here. But it has the same interface, so it'll be easy to swap in another implementation later if you need a bit more speed!

See the Sass website for more ways to install Sass.

Once you have Sass installed, you can run the sass executable to compile .sass and .scss files to .css files. For example:

sass source/stylesheets/index.scss build/stylesheets/index.css

Learn Sass

Check out the Sass website for a guide on how to learn Sass!

This Repository

This repository isn't an implementation of Sass. Those live in sass/dart-sass and sass/libsass. Instead, it contains:

  • spec/, which contains specifications for language features.
  • proposal/, which contains in-progress proposals for changes to the language.
  • accepted/, which contains proposals that have been accepted and are either implemented or in the process of being implemented.

Note that this doesn't contain a full specification of Sass. Instead, feature specifications are written as needed when a new feature is being designed or when an implementor needs additional clarity about how something is supposed to work. This means many of the specs in spec/ only cover small portions of the features in question.

Versioning Policy

The proposals in this repository are versioned, to make it easy to track changes over time and to refer to older versions. Every version has a Git tag of the form proposal.<name>.draft-<version>. A new version should be created for each batch of changes.

Every version has a major version, and they may have a minor version as well (indicated <major>.<minor>). The minor version should be incremented for changes that don't affect the intended semantics of the proposal; otherwise, the major version should be incremented.

libsass-python's People

Contributors

am11 avatar amcgregor avatar archgrove avatar asottile avatar astagi avatar caldwell avatar carsonmcdonald avatar craigbarnes avatar dahlia avatar hamptonmakes avatar jaddessi avatar jbussdieker avatar kornelski avatar larsimmisch avatar mgreter avatar michaek avatar nabellaleen avatar nschonni avatar pre-commit-ci[bot] avatar qulogic avatar rivy avatar rodneyrehm avatar ropp avatar rowanbeentje avatar samuelcolvin avatar stijnvn avatar uberska avatar wonja avatar xhmikosr avatar xzyfer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libsass-python's Issues

Suggested api changes

I think it would simplify the code to expose the following instead of compile:

def compile_string(s, **kwargs):
    # ...

# and

def compile_file(filename, **kwargs):
    # ...

and drop compile_directory (libsass has hard deprecated it)

libsass-0.5.1-cp27-none-win32.whl Fails to install on Windows 8.1

I am running Windows 8.1 64-bit.
I always run Python 2.7 in 32-bit mode
I installed libsass both via PIP & via the downloaded wheel.
Both times it fails in the same way when I try to import sass:

import sass
Traceback (most recent call last):
File "", line 1, in
File "c:\bin\python27\lib\site-packages\sass.py", line 21, in
from _sass import (OUTPUT_STYLES, SOURCE_COMMENTS, compile_dirname,
ImportError: DLL load failed: The specified module could not be found.

_sass.pyd is present in the same folder as sass.py

I don't have any Visual Studio to try & compile a version myself.
Are there any Win32 libs which I need installing on my system to get this working?

Error compiling with compass

I'm getting this error when trying to include compass:
"tmp/compass/compass/_support.scss:152: named arguments must precede variable-length argument"

Line 152 of _support.scss contains:
@include for-legacy-browser($browser, $range..., $threshold: $threshold, $ranges: $browsers) {

My code contains:
source = '@import "compass"; .... some styles here ....'
src_directories = ['tmp/somestyles', '/tmp/compass/']
compiled = sass.compile(string=source,include_paths=src_directories)

I'm using the latest version of Compass from Jan 15 (compass-1.0.3) and version 0.7.0 of libsass

Thanks!

builder.Manifest.build_one recursive css_path

If I try to use builder.Manifest.build_one to build a single .scss file the output .css file get's place 2 iterations of css-path down.

e.g
manifest = builder.Manifest(sass_path='static/sass', css_path='./static/css')
manifest.build_one('.','blog.scss')

will result in 'blog.scss.css' being placed at 'static/css/static/css'

I think line 182 in builder.py should read

css_path = os.path.join(package_dir, css_filename)

rather than

css_path = os.path.join(package_dir, self.css_path, css_filename)

Installed but DLL load failed

On Windows, Python 3.4 64bit.

pip install libsass
Requirement already satisfied (use --upgrade to upgrade): libsass in c:\python34\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): six in c:\python34\lib\site-packages (from libsass)

python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import sass
Traceback (most recent call last):
File "", line 1, in
File "C:\Python34\lib\site-packages\sass.py", line 24, in
from _sass import OUTPUT_STYLES, compile_filename, compile_string
ImportError: DLL load failed: %1 is not a valid Win32 application.

Help!

High memory usage during compilation

I've been having some trouble (pip) installing libsass in a container, seemingly because the compiler runs out of memory (my Docker host VM has about 300 MB free) and gets killed.

$ docker run -i -t python:3.4 pip install libsass
Collecting libsass
  Downloading libsass-0.8.2.tar.gz (229kB)
    100% |████████████████████████████████| 229kB 2.0MB/s
...
    gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./libsass -I/usr/local/include/python3.4m -c libsass/extend.cpp -o build/temp.linux-x86_64-3.4/libsass/extend.o -c -O3 -fPIC -std=c++0x -Wall -Wno-parentheses
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    gcc: internal compiler error: Killed (program cc1plus)
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
    error: command 'gcc' failed with exit status 4

    ----------------------------------------
Command "/usr/local/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-4ymrmerb/libsass/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record
/tmp/pip-bdkglgjs-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-4ymrmerb/libsass

By way of comparison (not sure if it's a valid comparison or not), Numpy compiles just fine, using less than half the memory when trying to compile libsass. Can any compilation arguments be added to allow building on more meager VMs?

output style documentation

libsass-python document,

output_style (str) – an optional coding style of the compiled result. choose one of: nested (default), expanded, compact, compressed

But there are no differences between nested, expanded, compact output_style of sass.compile. I was puzzled over this parameter.

>>> import sass
>>> scss_str = """nav {
...   ul {
...     margin: 0;
...     padding: 0;
...     list-style: none;
...   }
...
...   li { display: inline-block; }
...
...   a {
...     display: block;
...     padding: 6px 12px;
...     text-decoration: none;
...   }
... }"""
>>> nested = sass.compile(string=scss_str, output_style="nested")
>>> expanded = sass.compile(string=scss_str, output_style="expanded")
>>> compact = sass.compile(string=scss_str, output_style="compact")
>>> compressed = sass.compile(string=scss_str, output_style="compressed")
>>> nested == expanded
True
>>> nested == compact
True
>>> nested == compressed
False
>>>

Thanks.

Consider include wheel: cp27 + win32

I'm trying to install libsass-python on CPython27 win32.

I have VS C++ 2008 but it can't compile libsass. I tryed to install from wheels but theres only a adm_64 option.

Can you please include a win32 version?

If not, can you help me get this working? What I need to do?

Thanks.

More feedback on the compilation process - suggestion

Hi,

The guy using sass on my team asked me yesterday if there was a flag or something so he can just be watching the Flask console to see if something failed while changing his sass files instead of going to the generated file to see details on the exception. I couldn't find any and ended up adding:

print '*' * 80
print repr(e)
print '*' * 80

inside SassMiddleware.__call__ to get any exception info from any CompileError. This is absolutely raw but seems to be useful.

Maybe something nicer can be added, like a parameter to send errors to stderr or something like that.

Thanks,

Federico

New release?

It'd be nice if the latest changes were on pypi…

Source maps generation complaints

libsass produce local path in source comments, like /Users/username/path/to/project/file.scss, that I don't actually need in my production compressed files. But, on the other hand, i want to generate source map files. Currently I can't see how to solve this

Can't install on freebsd 9.3

For some reason I cannot get libsass to install using pip in my freebsd 9.3 jail. I did have it installed earlier only I had to create a new clean jail today and now it won't install.

I've tried with clang 3.4.1, gcc 4.8 and clang 3.6. They all fail in a similar way. Clang 3.4.1 is default.

Collecting libsass
  Using cached libsass-0.8.3.tar.gz
Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/site-packages (from libsass)
Installing collected packages: libsass
  Running setup.py install for libsass
    Complete output from command /usr/local/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-0XTh30/libsass/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-yRqter-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.freebsd-9.3-RELEASE-p26-amd64-2.7
    copying sass.py -> build/lib.freebsd-9.3-RELEASE-p26-amd64-2.7
    copying sassc.py -> build/lib.freebsd-9.3-RELEASE-p26-amd64-2.7
    copying sasstests.py -> build/lib.freebsd-9.3-RELEASE-p26-amd64-2.7
    creating build/lib.freebsd-9.3-RELEASE-p26-amd64-2.7/sassutils
    copying sassutils/wsgi.py -> build/lib.freebsd-9.3-RELEASE-p26-amd64-2.7/sassutils
    copying sassutils/distutils.py -> build/lib.freebsd-9.3-RELEASE-p26-amd64-2.7/sassutils
    copying sassutils/builder.py -> build/lib.freebsd-9.3-RELEASE-p26-amd64-2.7/sassutils
    copying sassutils/__init__.py -> build/lib.freebsd-9.3-RELEASE-p26-amd64-2.7/sassutils
    running build_ext
    building '_sass' extension
    creating build/temp.freebsd-9.3-RELEASE-p26-amd64-2.7
    creating build/temp.freebsd-9.3-RELEASE-p26-amd64-2.7/libsass
    clang++ -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -DNDEBUG -fPIC -I./libsass -I/usr/local/include/python2.7 -c libsass/sass2scss.cpp -o build/temp.freebsd-9.3-RELEASE-p26-amd64-2.7/libsass/sass2scss.o -c -O3 -fPIC -std=c++0x -Wall -Wno-parentheses -stdlib=libc++
    libsass/sass2scss.cpp:2:10: fatal error: 'stack' file not found
    #include <stack>
             ^
    1 error generated.
    error: command 'clang++' failed with exit status 1

    ----------------------------------------
Command "/usr/local/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-0XTh30/libsass/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-yRqter-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-0XTh30/libsass

Do I have to build the dll?

I installed (pip install libsass) , and got 'Successfully installed'. However, there is an error when
'import sass':

$ python -i
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sass
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Users\Jim\djangoproject\DJANGO\lib\site-packages\sass.py", line 22, i
n <module>
    from _sass import (OUTPUT_STYLES, compile_dirname,
ImportError: DLL load failed: The specified module could not be found.
>>> quit()

Am I supposed to compile the C++ code myself and install it somewhere?
(The OS is Windows 7).

Document how to compile Sass syntax from a string.

Maybe I'm just slow today but I am having a tough time puzzling this out...

>>> print open('file.sass').read()
body
    font: sans-serif
    p
        font-weight: bold

>>> import sass
>>> print sass.compile(filename='file.sass')
body {
  font: sans-serif; }
  body p {
    font-weight: bold; }

>>> print sass.compile(string=open('file.sass').read())
Traceback (most recent call last):
...
CompileError: Error: invalid top-level expression
        on line 1 of stdin
>> body
   ^

What am I doing wrong? I searched the "References" part of the docs for 'SCSS' and found nothing, I can't seem to figure out how to tell sass.compile(string=...) that I want Sass syntax and not SCSS.

Trouble Installing 0.6.0 on Travis CI

pip installs on Travis are failing for 0.6.0. 0.5.1 works. You can view the full output at https://travis-ci.org/edx/edx-analytics-dashboard/builds/39157543. The error messages have been copied below.

pip install -q -r requirements/base.txt --exists-action w
  Could not find a tag or branch '0d7847f9dfa2281640527b4dc51f5854f950f9b7', assuming commit.
  Could not find a tag or branch 'd45d0bd8d64c69531be69178b9505b5d38806ce0', assuming commit.
Command /home/travis/virtualenv/python2.7.8/bin/python -c "import setuptools, tokenize;__file__='/home/travis/virtualenv/python2.7.8/build/libsass/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-mfLxMF-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/travis/virtualenv/python2.7.8/include/site/python2.7 failed with error code 1 in /home/travis/virtualenv/python2.7.8/build/libsass
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7.8/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)
make: *** [requirements] Error 1

PyPi release

Hi, just a friendly reminder to publish 0.8.2 to pypi (we need one of the fixes in libsass 3.2.4). In the meantime we are pip installing via git.

Thanks!

Python 3 support

Hey, I was wondering if support for Python 3 is planned. It currently does not install, the unit tests do not run and the dependencies needed for the unit tests don't support Python 3.

I'm attemping to make it work in Python 3 and so far I've managed to make the package install and run the compile function (only with byte strings). Next step is unicode. ☃

The dependencies need to be replaced since they don't support Python 3. Attest is supposed to work, but it's dependency, progressbar doesn't work. I don't know what Werkzeug's status is.

  • Package installation
  • Importing the Sass module
  • Compile Sass text (only byte strings)
  • Use unicode strings instead of byte strings
  • Find replacements for the Python 2 only modules used in the unit tests
  • Redo the unit tests
  • Test everything with Python 2, Python 3 and PyPy

error compiling glyph fonts

I attempted to use libsass as a way to integrate Materialize css (http://materializecss.com) into my django stack.

I was simply using sassc to compile the materialize.scss file and libsass strips the content value out of the out going css.

Something that should compile to this
.mdi-navigation-menu:before{content:"\e8a1"}

Compiles to this
.mdi-navigation-menu:before {content: ; }

If you have any other questions about how I found this error feel free message me for more details.

Strip Sass extension from output file

Using this simple script here:

import sassutils.builder

result = sassutils.builder.build_directory(".", ".", "compressed")
print(result)  # Outputs {'style.scss': 'style.scss.css'}

And indeed, the output file name is style.scss.css. Ideally it should be called simply style.css. :)

fails to build on heroku (ubuntu)

Thought you may want to know that when I attempt to pip install this for my django project on heroku for the first time the gcc build fails in several places. Here's the gcc -v info from the heroku console:

Running `gcc -v` attached to terminal... up, run.3892
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5.1' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1) 

and the rather lengthy error messages:

       Installing collected packages: libsass
         Running setup.py install for libsass
           building '_sass' extension
           gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./libsass -I/app/.heroku/python/include/python2.7 -c pysass.cpp -o build/temp.linux-x86_64-2.7/pysass.o -c -O2 -fPIC -std=c++0x -Wall -Wno-parentheses
           cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
           In file included from /app/.heroku/python/include/python2.7/Python.h:8,
                            from pysass.cpp:4:
           /app/.heroku/python/include/python2.7/pyconfig.h:1182:1: warning: "_POSIX_C_SOURCE" redefined
           In file included from /usr/include/unistd.h:26,
                            from pysass.cpp:1:
           /usr/include/features.h:158:1: warning: this is the location of the previous definition
           In file included from /app/.heroku/python/include/python2.7/Python.h:8,
                            from pysass.cpp:4:
           /app/.heroku/python/include/python2.7/pyconfig.h:1204:1: warning: "_XOPEN_SOURCE" redefined
           In file included from /usr/include/unistd.h:26,
                            from pysass.cpp:1:
           /usr/include/features.h:160:1: warning: this is the location of the previous definition
           gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./libsass -I/app/.heroku/python/include/python2.7 -c libsass/output_compressed.cpp -o build/temp.linux-x86_64-2.7/libsass/output_compressed.o -c -O2 -fPIC -std=c++0x -Wall -Wno-parentheses
           cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
           In file included from libsass/output_compressed.cpp:3:
           libsass/ast.hpp: In constructor ‘Sass::Hashed::Hashed(size_t)’:
           libsass/ast.hpp:211: error: ‘class std::unordered_map<Sass::Expression*, Sass::Expression*, std::hash<Sass::Expression*>, std::equal_to<Sass::Expression*>, std::allocator<std::pair<Sass::Expression* const, Sass::Expression*> > >’ has no member named ‘reserve’
           libsass/ast.hpp: In member function ‘Sass::Hashed& Sass::Hashed::operator+=(Sass::Hashed*)’:
           libsass/ast.hpp:236: error: expected initializer before ‘:’ token
           libsass/ast.hpp:239: error: expected primary-expression before ‘return’
           libsass/ast.hpp:239: error: expected ‘;’ before ‘return’
           libsass/ast.hpp:239: error: expected primary-expression before ‘return’
           libsass/ast.hpp:239: error: expected ‘)’ before ‘return’
           libsass/ast.hpp: In member function ‘virtual bool Sass::Map::operator==(Sass::Expression&) const’:
           libsass/ast.hpp:719: error: expected initializer before ‘:’ token
           libsass/ast.hpp:721: error: expected primary-expression before ‘return’
           libsass/ast.hpp:721: error: expected ‘;’ before ‘return’
           libsass/ast.hpp:721: error: expected primary-expression before ‘return’
           libsass/ast.hpp:721: error: expected ‘)’ before ‘return’
           libsass/ast.hpp: In member function ‘virtual size_t Sass::Map::hash()’:
           libsass/ast.hpp:733: error: expected initializer before ‘:’ token
           libsass/ast.hpp:736: error: expected primary-expression before ‘return’
           libsass/ast.hpp:736: error: expected ‘;’ before ‘return’
           libsass/ast.hpp:736: error: expected primary-expression before ‘return’
           libsass/ast.hpp:736: error: expected ‘)’ before ‘return’
           libsass/ast.hpp: In member function ‘virtual size_t Sass::Function_Call::hash()’:
           libsass/ast.hpp:920: error: expected initializer before ‘:’ token
           libsass/ast.hpp:923: error: expected primary-expression before ‘return’
           libsass/ast.hpp:923: error: expected ‘;’ before ‘return’
           libsass/ast.hpp:923: error: expected primary-expression before ‘return’
           libsass/ast.hpp:923: error: expected ‘)’ before ‘return’
           In file included from libsass/output_compressed.cpp:3:
           libsass/ast.hpp: In member function ‘virtual size_t Sass::String_Schema::hash()’:
           libsass/ast.hpp:1257: error: expected initializer before ‘:’ token
           libsass/ast.hpp:1260: error: expected primary-expression before ‘return’
           libsass/ast.hpp:1260: error: expected ‘;’ before ‘return’
           libsass/ast.hpp:1260: error: expected primary-expression before ‘return’
           libsass/ast.hpp:1260: error: expected ‘)’ before ‘return’
           error: command 'gcc' failed with exit status 1
           Complete output from command /app/.heroku/python/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-kpXICD/libsass/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-fg67mi-record/install-record.txt --single-version-externally-managed --compile:
           running install

           running build

           running build_py

           creating build

           creating build/lib.linux-x86_64-2.7

           copying sass.py -> build/lib.linux-x86_64-2.7

           copying sassc.py -> build/lib.linux-x86_64-2.7

           copying sasstests.py -> build/lib.linux-x86_64-2.7

           creating build/lib.linux-x86_64-2.7/sassutils

           copying sassutils/__init__.py -> build/lib.linux-x86_64-2.7/sassutils

           copying sassutils/wsgi.py -> build/lib.linux-x86_64-2.7/sassutils

           copying sassutils/builder.py -> build/lib.linux-x86_64-2.7/sassutils

           copying sassutils/distutils.py -> build/lib.linux-x86_64-2.7/sassutils

           running build_ext

           building '_sass' extension

           creating build/temp.linux-x86_64-2.7

           creating build/temp.linux-x86_64-2.7/libsass

           gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./libsass -I/app/.heroku/python/include/python2.7 -c pysass.cpp -o build/temp.linux-x86_64-2.7/pysass.o -c -O2 -fPIC -std=c++0x -Wall -Wno-parentheses

           cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++

           In file included from /app/.heroku/python/include/python2.7/Python.h:8,

                            from pysass.cpp:4:

           /app/.heroku/python/include/python2.7/pyconfig.h:1182:1: warning: "_POSIX_C_SOURCE" redefined

           In file included from /usr/include/unistd.h:26,

                            from pysass.cpp:1:

           /usr/include/features.h:158:1: warning: this is the location of the previous definition

           In file included from /app/.heroku/python/include/python2.7/Python.h:8,

                            from pysass.cpp:4:

           /app/.heroku/python/include/python2.7/pyconfig.h:1204:1: warning: "_XOPEN_SOURCE" redefined

           In file included from /usr/include/unistd.h:26,

                            from pysass.cpp:1:

           /usr/include/features.h:160:1: warning: this is the location of the previous definition

           gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./libsass -I/app/.heroku/python/include/python2.7 -c libsass/output_compressed.cpp -o build/temp.linux-x86_64-2.7/libsass/output_compressed.o -c -O2 -fPIC -std=c++0x -Wall -Wno-parentheses

           cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++

           In file included from libsass/output_compressed.cpp:3:

           libsass/ast.hpp: In constructor ‘Sass::Hashed::Hashed(size_t)’:

           libsass/ast.hpp:211: error: ‘class std::unordered_map<Sass::Expression*, Sass::Expression*, std::hash<Sass::Expression*>, std::equal_to<Sass::Expression*>, std::allocator<std::pair<Sass::Expression* const, Sass::Expression*> > >’ has no member named ‘reserve’

           libsass/ast.hpp: In member function ‘Sass::Hashed& Sass::Hashed::operator+=(Sass::Hashed*)’:

           libsass/ast.hpp:236: error: expected initializer before ‘:’ token

           libsass/ast.hpp:239: error: expected primary-expression before ‘return’

           libsass/ast.hpp:239: error: expected ‘;’ before ‘return’

           libsass/ast.hpp:239: error: expected primary-expression before ‘return’

           libsass/ast.hpp:239: error: expected ‘)’ before ‘return’

           libsass/ast.hpp: In member function ‘virtual bool Sass::Map::operator==(Sass::Expression&) const’:

           libsass/ast.hpp:719: error: expected initializer before ‘:’ token

           libsass/ast.hpp:721: error: expected primary-expression before ‘return’

           libsass/ast.hpp:721: error: expected ‘;’ before ‘return’

           libsass/ast.hpp:721: error: expected primary-expression before ‘return’

           libsass/ast.hpp:721: error: expected ‘)’ before ‘return’

           libsass/ast.hpp: In member function ‘virtual size_t Sass::Map::hash()’:

           libsass/ast.hpp:733: error: expected initializer before ‘:’ token

           libsass/ast.hpp:736: error: expected primary-expression before ‘return’

           libsass/ast.hpp:736: error: expected ‘;’ before ‘return’

           libsass/ast.hpp:736: error: expected primary-expression before ‘return’

           libsass/ast.hpp:736: error: expected ‘)’ before ‘return’

           libsass/ast.hpp: In member function ‘virtual size_t Sass::Function_Call::hash()’:

           libsass/ast.hpp:920: error: expected initializer before ‘:’ token

           libsass/ast.hpp:923: error: expected primary-expression before ‘return’

           libsass/ast.hpp:923: error: expected ‘;’ before ‘return’

           libsass/ast.hpp:923: error: expected primary-expression before ‘return’

           libsass/ast.hpp:923: error: expected ‘)’ before ‘return’

           In file included from libsass/output_compressed.cpp:3:

           libsass/ast.hpp: In member function ‘virtual size_t Sass::String_Schema::hash()’:

           libsass/ast.hpp:1257: error: expected initializer before ‘:’ token

           libsass/ast.hpp:1260: error: expected primary-expression before ‘return’

           libsass/ast.hpp:1260: error: expected ‘;’ before ‘return’

           libsass/ast.hpp:1260: error: expected primary-expression before ‘return’

           libsass/ast.hpp:1260: error: expected ‘)’ before ‘return’

           error: command 'gcc' failed with exit status 1

           ----------------------------------------
           Command "/app/.heroku/python/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-kpXICD/libsass/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-fg67mi-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-kpXICD/libsass

I've got this working fine on my OSX dev box, so too bad.

Work with python-scss

This isn't really a bug. I just wanted to point out the other python wrapper here: https://github.com/pistolero/python-scss I haven't really looked too deeply into whether one is better than the other. However, I do see that python-scss uses libsass as a git subrepo, which might be a better idea if you don't intend the Python stuff to be merged with libsass. Anyway, I think it would be better to pool resources, don't confuse users by having two wrappers, etc.

See also: pistolero/python-scss#7

Variable substitution in @media rules

This doesn't work, but probably should:

$foo: 3;
@media (max-width: $foo) {
  body { color: black; }
}

Comparing output from ruby-based sass with python-based sassc:

$ sass t.scss > sass.css
$ sassc t.scss > sassc.css
$ diff sass.css sassc.css
1c1
< @media (max-width: 3) {

---
> @media (max-width: $foo) {
3a4
> 

Given there's a test for this in the underlying C libsass, I assume this project is just carrying an older version of the library?

Crash with media queries

$ python -c "import sass; sass.compile(filename='crash.scss')"
Segmentation fault (core dumped)

content of crash.scss is just:

@media (max-width:979px) { }

Build fails on Heroku

Glad to hear that libsass-python is again compatible with older GCC versions.
However when I try to deploy my app to Heroku with libsass-python 0.6.2, it still fails.

         Running setup.py install for libsass
           building '_sass' extension
           gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./libsass -I/app/.heroku/python/include/python2.7 -c pysass.cpp -o build/temp.linux-x86_64-2.7/pysass.o -c -O2 -fPIC -std=c++0x -Wall -Wno-parentheses
           cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
           In file included from /app/.heroku/python/include/python2.7/Python.h:8,
                            from pysass.cpp:4:
           /app/.heroku/python/include/python2.7/pyconfig.h:1182:1: warning: "_POSIX_C_SOURCE" redefined
           In file included from /usr/include/unistd.h:26,
                            from pysass.cpp:1:
           /usr/include/features.h:158:1: warning: this is the location of the previous definition
           In file included from /app/.heroku/python/include/python2.7/Python.h:8,
                            from pysass.cpp:4:
           /app/.heroku/python/include/python2.7/pyconfig.h:1204:1: warning: "_XOPEN_SOURCE" redefined
           In file included from /usr/include/unistd.h:26,
                            from pysass.cpp:1:
           /usr/include/features.h:160:1: warning: this is the location of the previous definition
           gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./libsass -I/app/.heroku/python/include/python2.7 -c libsass/output_compressed.cpp -o build/temp.linux-x86_64-2.7/libsass/output_compressed.o -c -O2 -fPIC -std=c++0x -Wall -Wno-parentheses
           cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
           In file included from libsass/output_compressed.cpp:3:
           libsass/ast.hpp: In constructor ???Sass::Hashed::Hashed(size_t)???:
           libsass/ast.hpp:211: error: ???class std::unordered_map<Sass::Expression*, Sass::Expression*, std::hash<Sass::Expression*>, std::equal_to<Sass::Expression*>, std::allocator<std::pair<Sass::Expression* const, Sass::Expression*> > >??? has no member named ???reserve???
           libsass/ast.hpp: In member function ???Sass::Hashed& Sass::Hashed::operator+=(Sass::Hashed*)???:
           libsass/ast.hpp:236: error: expected initializer before ???:??? token
           libsass/ast.hpp:239: error: expected primary-expression before ???return???
           libsass/ast.hpp:239: error: expected ???;??? before ???return???
           libsass/ast.hpp:239: error: expected primary-expression before ???return???
           libsass/ast.hpp:239: error: expected ???)??? before ???return???
           libsass/ast.hpp: In member function ???virtual bool Sass::Map::operator==(Sass::Expression&) const???:
           libsass/ast.hpp:719: error: expected initializer before ???:??? token
           libsass/ast.hpp:721: error: expected primary-expression before ???return???
           libsass/ast.hpp:721: error: expected ???;??? before ???return???
           libsass/ast.hpp:721: error: expected primary-expression before ???return???
           libsass/ast.hpp:721: error: expected ???)??? before ???return???
           libsass/ast.hpp: In member function ???virtual size_t Sass::Map::hash()???:
           libsass/ast.hpp:733: error: expected initializer before ???:??? token
           libsass/ast.hpp:736: error: expected primary-expression before ???return???
           libsass/ast.hpp:736: error: expected ???;??? before ???return???
           libsass/ast.hpp:736: error: expected primary-expression before ???return???
           libsass/ast.hpp:736: error: expected ???)??? before ???return???
           libsass/ast.hpp: In member function ???virtual size_t Sass::Function_Call::hash()???:
           libsass/ast.hpp:920: error: expected initializer before ???:??? token
           libsass/ast.hpp:923: error: expected primary-expression before ???return???
           libsass/ast.hpp:923: error: expected ???;??? before ???return???
           libsass/ast.hpp:923: error: expected primary-expression before ???return???
           libsass/ast.hpp:923: error: expected ???)??? before ???return???
           In file included from libsass/output_compressed.cpp:3:
           libsass/ast.hpp: In member function ???virtual size_t Sass::String_Schema::hash()???:
           libsass/ast.hpp:1257: error: expected initializer before ???:??? token
           libsass/ast.hpp:1260: error: expected primary-expression before ???return???
           libsass/ast.hpp:1260: error: expected ???;??? before ???return???
           libsass/ast.hpp:1260: error: expected primary-expression before ???return???
           libsass/ast.hpp:1260: error: expected ???)??? before ???return???
           error: command 'gcc' failed with exit status 1
           Complete output from command /app/.heroku/python/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_u55118/libsass/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Vy_BxU-record/install-record.txt --single-version-externally-managed --compile:
           running install

       running build

       running build_py

       creating build

       creating build/lib.linux-x86_64-2.7

       copying sass.py -> build/lib.linux-x86_64-2.7

       copying sassc.py -> build/lib.linux-x86_64-2.7

       copying sasstests.py -> build/lib.linux-x86_64-2.7

       creating build/lib.linux-x86_64-2.7/sassutils

       copying sassutils/wsgi.py -> build/lib.linux-x86_64-2.7/sassutils

       copying sassutils/distutils.py -> build/lib.linux-x86_64-2.7/sassutils

       copying sassutils/__init__.py -> build/lib.linux-x86_64-2.7/sassutils

       copying sassutils/builder.py -> build/lib.linux-x86_64-2.7/sassutils

       running build_ext

       building '_sass' extension

       creating build/temp.linux-x86_64-2.7

       creating build/temp.linux-x86_64-2.7/libsass

       gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./libsass -I/app/.heroku/python/include/python2.7 -c pysass.cpp -o build/temp.linux-x86_64-2.7/pysass.o -c -O2 -fPIC -std=c++0x -Wall -Wno-parentheses

       cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++

       In file included from /app/.heroku/python/include/python2.7/Python.h:8,

                        from pysass.cpp:4:

       /app/.heroku/python/include/python2.7/pyconfig.h:1182:1: warning: "_POSIX_C_SOURCE" redefined

       In file included from /usr/include/unistd.h:26,

                        from pysass.cpp:1:

       /usr/include/features.h:158:1: warning: this is the location of the previous definition

       In file included from /app/.heroku/python/include/python2.7/Python.h:8,

                        from pysass.cpp:4:

       /app/.heroku/python/include/python2.7/pyconfig.h:1204:1: warning: "_XOPEN_SOURCE" redefined

       In file included from /usr/include/unistd.h:26,

                        from pysass.cpp:1:

       /usr/include/features.h:160:1: warning: this is the location of the previous definition

       gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./libsass -I/app/.heroku/python/include/python2.7 -c libsass/output_compressed.cpp -o build/temp.linux-x86_64-2.7/libsass/output_compressed.o -c -O2 -fPIC -std=c++0x -Wall -Wno-parentheses

       cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++

       In file included from libsass/output_compressed.cpp:3:

       libsass/ast.hpp: In constructor ???Sass::Hashed::Hashed(size_t)???:

       libsass/ast.hpp:211: error: ???class std::unordered_map<Sass::Expression*, Sass::Expression*, std::hash<Sass::Expression*>, std::equal_to<Sass::Expression*>, std::allocator<std::pair<Sass::Expression* const, Sass::Expression*> > >??? has no member named ???reserve???

       libsass/ast.hpp: In member function ???Sass::Hashed& Sass::Hashed::operator+=(Sass::Hashed*)???:

       libsass/ast.hpp:236: error: expected initializer before ???:??? token

       libsass/ast.hpp:239: error: expected primary-expression before ???return???

       libsass/ast.hpp:239: error: expected ???;??? before ???return???

       libsass/ast.hpp:239: error: expected primary-expression before ???return???

       libsass/ast.hpp:239: error: expected ???)??? before ???return???

       libsass/ast.hpp: In member function ???virtual bool Sass::Map::operator==(Sass::Expression&) const???:

       libsass/ast.hpp:719: error: expected initializer before ???:??? token

       libsass/ast.hpp:721: error: expected primary-expression before ???return???

       libsass/ast.hpp:721: error: expected ???;??? before ???return???

       libsass/ast.hpp:721: error: expected primary-expression before ???return???

       libsass/ast.hpp:721: error: expected ???)??? before ???return???

       libsass/ast.hpp: In member function ???virtual size_t Sass::Map::hash()???:

       libsass/ast.hpp:733: error: expected initializer before ???:??? token

       libsass/ast.hpp:736: error: expected primary-expression before ???return???

       libsass/ast.hpp:736: error: expected ???;??? before ???return???

       libsass/ast.hpp:736: error: expected primary-expression before ???return???

       libsass/ast.hpp:736: error: expected ???)??? before ???return???

       libsass/ast.hpp: In member function ???virtual size_t Sass::Function_Call::hash()???:

       libsass/ast.hpp:920: error: expected initializer before ???:??? token

       libsass/ast.hpp:923: error: expected primary-expression before ???return???

       libsass/ast.hpp:923: error: expected ???;??? before ???return???

       libsass/ast.hpp:923: error: expected primary-expression before ???return???

       libsass/ast.hpp:923: error: expected ???)??? before ???return???

       In file included from libsass/output_compressed.cpp:3:

       libsass/ast.hpp: In member function ???virtual size_t Sass::String_Schema::hash()???:

       libsass/ast.hpp:1257: error: expected initializer before ???:??? token

       libsass/ast.hpp:1260: error: expected primary-expression before ???return???

       libsass/ast.hpp:1260: error: expected ???;??? before ???return???

       libsass/ast.hpp:1260: error: expected primary-expression before ???return???

       libsass/ast.hpp:1260: error: expected ???)??? before ???return???

       error: command 'gcc' failed with exit status 1

       ----------------------------------------
       Cleaning up...
       Command /app/.heroku/python/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_u55118/libsass/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Vy_BxU-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_u55118/libsass
Traceback (most recent call last):
  File "/app/.heroku/python/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 36: ordinal not in range(128)

 !     Push rejected, failed to compile Multipack app

Compiling on CentOS 6 (GCC 4.4) failure

README still says GCC (G++) 4.3+ is needed but apparently that's no longer true because anything newer than libsass-python 0.5.0 fails on CentOS 6. That seems to include the 0.6.2 version as well, which explicitly state that 0.6.0 through 0.6.1 had issues ...?

Support indented syntax for string input

libsass supports the indented syntax, e.g.,

p
  a
    color: blue

This binding correctly handles files written in the indented syntax if passed as filenames with the .sass extension, e.g.,

sass.compile(filename="foobar.sass")

... but has no support for the indented syntax as string input, e.g.,

sass.compile(string="p\n  a\n    color: blue\n")

Perhaps a keyword parameter, e.g., syntax="sass" / syntax="scss"?

Bootstrap sass error

Libsass had error on if statement reported on bootstrap sass project.

This error has already been fixed, node-sass in version 0.8.6 handle bootstrap sass.

When I try compile bootstrap sass on libsass-python v 0.4.0 I am receiving:
error: non-terminal statement or declaration must end with ';'

segfault on ctrl-c

Reproduction: ctrl-c during our build

@asottile

Bottom (innermost) frame selected; you cannot go down.                                                                                  │
(gdb) bt                                                                                                                                │
#0  0x000000000045ec23 in PyList_Insert ()                                                                                              │
#1  0x00002b92179fc573 in _exception_to_sass_error (sass_args=<value optimized out>, cookie=<value optimized out>) at pysass.cpp:298    │
#2  _call_py_f (sass_args=<value optimized out>, cookie=<value optimized out>) at pysass.cpp:385                                        │
#3  0x00002b921798753b in Sass::Eval::operator() (this=<value optimized out>, c=0x2ef4bd0) at libsass/eval.cpp:528                      │
#4  0x00002b921796b77a in Sass::Expand::operator() (this=0x7ffce6555be0, d=<value optimized out>) at libsass/expand.cpp:136             │
#5  0x00002b921796ccd1 in Sass::Expand::append_block (this=0x7ffce6555be0, b=0x2ef4280) at libsass/expand.cpp:426                       │
#6  Sass::Expand::operator() (this=0x7ffce6555be0, b=0x2ef4280) at libsass/expand.cpp:37                                                │
#7  0x00002b921797162f in Sass::Expand::operator() (this=0x7ffce6555be0, r=0x2ef5020) at libsass/expand.cpp:54                          │
#8  0x00002b92179700d9 in Sass::Expand::append_block (this=0x7ffce6555be0, i=<value optimized out>) at libsass/expand.cpp:426           │
#9  Sass::Expand::operator() (this=0x7ffce6555be0, i=<value optimized out>) at libsass/expand.cpp:171                                   │
#10 0x00002b921796ccd1 in Sass::Expand::append_block (this=0x7ffce6555be0, b=0x2db39b0) at libsass/expand.cpp:426                       │
#11 Sass::Expand::operator() (this=0x7ffce6555be0, b=0x2db39b0) at libsass/expand.cpp:37                                                │
#12 0x00002b921796751d in Sass::Context::parse_file (this=<value optimized out>) at libsass/context.cpp:286                             │
#13 0x00002b921793bb4a in sass_parse_block (c_ctx=0x28db260, cpp_ctx=0x2d91120) at libsass/sass_context.cpp:382                         │
#14 0x00002b921793cb43 in sass_compile_context (c_ctx=0x28db260, cpp_opt=<value optimized out>) at libsass/sass_context.cpp:411         │
#15 0x00002b921793cee3 in sass_compile_file_context (file_ctx=0x28db260) at libsass/sass_context.cpp:524                                │
#16 0x00002b92179fb59b in PySass_compile_filename (self=<value optimized out>, args=<value optimized out>) at pysass.cpp:499            │
#17 0x00000000004df571 in PyEval_EvalFrameEx ()                                                                                         │
#18 0x00000000004e0e21 in PyEval_EvalCodeEx ()                                                                                          │
#19 0x00000000004dee85 in PyEval_EvalFrameEx ()                                                                                         │
#20 0x00000000004e0e21 in PyEval_EvalCodeEx ()                                                                                          │
#21 0x00000000004dee85 in PyEval_EvalFrameEx ()                                                                                         │
#22 0x00000000004e0e21 in PyEval_EvalCodeEx ()                                                                                          │
#23 0x00000000004dee85 in PyEval_EvalFrameEx ()                                                                                         │
#24 0x00000000004e0e21 in PyEval_EvalCodeEx ()                                                                                          │
#25 0x00000000004dee85 in PyEval_EvalFrameEx ()                                                                                         │
#26 0x00000000004e0e21 in PyEval_EvalCodeEx ()                                                                                          │
#27 0x00000000004dee85 in PyEval_EvalFrameEx ()                                                                                         │
#28 0x00000000004e0e21 in PyEval_EvalCodeEx ()                                                                                          │
#29 0x00000000004e0f32 in PyEval_EvalCode ()                                                                                            │
#30 0x0000000000501cce in PyRun_FileExFlags ()                                                                                          │
#31 0x0000000000501ef7 in PyRun_SimpleFileExFlags ()                                                                                    │
#32 0x000000000051783d in Py_Main ()                                                                                                    │
#33 0x00002b9217070c8d in __libc_start_main (main=<value optimized out>, argc=<value optimized out>, ubp_av=<value optimized out>,      │
    init=<value optimized out>, fini=<value optimized out>, rtld_fini=<value optimized out>, stack_end=0x7ffce6556fe8)                  │
    at libc-start.c:226                                                                                                                 │
#34 0x000000000041b329 in _start ()

unable to install libsass using pip on Mac OS X

pip install libsass fails on Mac OS X. I am using Mac OS X Snow Leopard and llvm-gcc-4.2.


Downloading/unpacking libsass
  Running setup.py egg_info for package libsass

Installing collected packages: libsass
  Running setup.py install for libsass
    building 'sass' extension
    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -DLIBSASS_PYTHON_VERSION="0.2.4" -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c sass.c -o build/temp.macosx-10.6-intel-2.7/sass.o -c -O2 -fPIC -Wall -Wno-parentheses -Wno-tautological-compare
    cc1: error: unrecognized command line option "-Wno-tautological-compare"
    cc1: error: unrecognized command line option "-Wno-tautological-compare"
    lipo: can't figure out the architecture type of: /var/folders/AL/ALVaJxRCEMqCTtdGB14pzE+++TI/-Tmp-//cch2WYF9.out
    error: command 'gcc-4.2' failed with exit status 1
    Complete output from command /Users/kang/workspace/fasticker/bin/python2.7 -c "import setuptools;__file__='/Users/kang/workspace/fasticker/build/libsass/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/AL/ALVaJxRCEMqCTtdGB14pzE+++TI/-Tmp-/pip-A3V84k-record/install-record.txt --install-headers /Users/kang/workspace/fasticker/bin/../include/site/python2.7:
    running install

running build

running build_py

running build_ext

building 'sass' extension

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -DLIBSASS_PYTHON_VERSION="0.2.4" -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c sass.c -o build/temp.macosx-10.6-intel-2.7/sass.o -c -O2 -fPIC -Wall -Wno-parentheses -Wno-tautological-compare

cc1: error: unrecognized command line option "-Wno-tautological-compare"

cc1: error: unrecognized command line option "-Wno-tautological-compare"

lipo: can't figure out the architecture type of: /var/folders/AL/ALVaJxRCEMqCTtdGB14pzE+++TI/-Tmp-//cch2WYF9.out

error: command 'gcc-4.2' failed with exit status 1

----------------------------------------
Command /Users/kang/workspace/fasticker/bin/python2.7 -c "import setuptools;__file__='/Users/kang/workspace/fasticker/build/libsass/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/AL/ALVaJxRCEMqCTtdGB14pzE+++TI/-Tmp-/pip-A3V84k-record/install-record.txt --install-headers /Users/kang/workspace/fasticker/bin/../include/site/python2.7 failed with error code 1 in /Users/kang/workspace/fasticker/build/libsass
Storing complete log in /Users/kang/.pip/pip.log

libsass-python pulls different versions of libsass?

I use this excellent library as part of a build pipeline that ends with fingerprinting of my final minified css file. Yesterday (as I was preparing and then launched my site) I encountered an extremely frustrating bug.

In my requirements.txt file I have libsass==0.7.0. One of my servers was brought up a few weeks ago and everything worked great. In anticipation of high load I brought up a second server just before launch. The launch went off without a hitch except that sometimes the page would render with no CSS when you hit one of the servers; I traced this back to a different fingerprint on my css file. After verifying the python-libsass versions I ran the build process on each server individually and saw that my file outputs differed by a single line (the @charset declaration if you're interested). After looking at various things such as my locale I was able to fix the issue on both servers by running pip uninstall libsass and then pip install libsass==0.7.0.

To say this was annoying to track down would be an understatement. I don't think that something like this should be even possible with the same version of the python bindings but I'm not familiar enough with C extension packaging to suggest a fix. Thanks for reading and great library!

Keep emitting source map on save in watch mode

This is quite useful feature whom develops heavy in devtools.

Currently, these command line options:

$ sassc [inputfile] [outputfile] -w -m

nor

$ sassc [inputfile] [outputfile] -wm

don't emit source map.

error: invalid argument '-std=c++0x' not allowed with 'C/ObjC' FreeBSD 10/11

I was trying to install django-libsass and come up with this issue (torchbox/django-libsass#3)

cc -fno-strict-aliasing -O2 -pipe -fno-strict-aliasing -DNDEBUG -fPIC -I./libsass -I/usr/local/include/python2.7 -c libsass/cencode.c -o build/temp.freebsd-11.0-CURRENT-amd64-2.7/libsass/cencode.o -c -O2 -fPIC -std=c++0x -Wall -Wno-parentheses

error: invalid argument '-std=c++0x' not allowed with 'C/ObjC'

error: command 'cc' failed with exit status 1

cc is clang v 3.4.1 here and it seems not to like "c++0x"

I downloaded the git version and tried to build and I do get the same error:
"error: invalid argument '-std=c++0x' not allowed with 'C/ObjC'"

Thanks

Bug with extending some selector contain nested selector

I tried some test.

Conditions

  1. requirements (git submodule) for external scss framework

    git submodule add --name bootstrap-sass [email protected]:twbs/bootstrap-sass.git
  2. test.scss

    @import "bootstrap-sass/assets/stylesheets/bootstrap";
    
    .test {
      @extend .table;
    }

Tests

libsass-python's sassc command

Output (I added some new line to pretty view)

.table > thead > tr > th, 
  .table > thead > tr > .test, 
  .table > thead > tr > td, 
  .table > thead > tr > .test, 
  .table > tbody > tr > th, 
  .table > tbody > tr > .test, 
  .table > tbody > tr > td, 
  .table > tbody > tr > .test, 
  .table > tfoot > tr > th, 
  .table > tfoot > tr > .test, 
  .table > tfoot > tr > td, 
  .table > tfoot > tr > .test {
    padding: 8px;
    line-height: 1.42857;
    vertical-align: top;
    border-top: 1px solid #ddd; }

Result: wrong

ruby sass command

Output

.table > thead > tr > th, .test > thead > tr > th,
  .table > thead > tr > td,
  .test > thead > tr > td,
  .table > tbody > tr > th,
  .test > tbody > tr > th,
  .table > tbody > tr > td,
  .test > tbody > tr > td,
  .table > tfoot > tr > th,
  .test > tfoot > tr > th,
  .table > tfoot > tr > td,
  .test > tfoot > tr > td {
    padding: 8px;
    line-height: 1.42857;
    vertical-align: top;
    border-top: 1px solid #ddd; }

Result: correct

sassc (libsass CLI implementation)

Output

.table > thead > tr > th, 
  .test > thead > tr > th, 
  .table > thead > tr > td, 
  .test > thead > tr > td, 
  .table > tbody > tr > th, 
  .test > tbody > tr > th, 
  .table > tbody > tr > td, 
  .test > tbody > tr > td, 
  .table > tfoot > tr > th, 
  .test > tfoot > tr > th, 
  .table > tfoot > tr > td, 
  .test > tfoot > tr > td {
    padding: 8px;
    line-height: 1.42857;
    vertical-align: top;
    border-top: 1px solid #ddd; }

Result: correct

sassc v1.0.1 with libsass v2.0.0

Output

.table > thead > tr > th, 
  .table > thead > tr > .test, 
  .table > thead > tr > td, 
  .table > thead > tr > .test, 
  .table > tbody > tr > th, 
  .table > tbody > tr > .test, 
  .table > tbody > tr > td, 
  .table > tbody > tr > .test, 
  .table > tfoot > tr > th, 
  .table > tfoot > tr > .test, 
  .table > tfoot > tr > td, 
  .table > tfoot > tr > .test {
    padding: 8px;
    line-height: 1.42857;
    vertical-align: top;
    border-top: 1px solid #ddd; }

Result: wrong


I (also) think it is libsass 2.0's problem. if someone faced problems like this, he must wait for supporting next libsass version.

I cannot build libsass on Mac OSX 10.7 (Lion)

I get this error while trying to build libsass via pip on Mac OSX 10.7.

cc1: error: -Werror=unused-command-line-argument-hard-error-in-future: No option -Wunused-command-line-argument-hard-error-in-future

It looks like its a flag only supported by newer versions of GCC, and OSX 10.7 is stuck with GCC 1.2 via XCode and friends. Do you know of some way around this?

Errors on non-breaking space

I've yet to track down the source file, but compiling this folder using the following command:

sass.compile(dirname=(".", "."), output_style="compressed")

Produces the following error:

Traceback (most recent call last):
  File "C:\Users\le717\Documents\Code\Sites\Own-Domain\build-css.py", line 8, in
 <module>
    sass.compile(dirname=(".", "."), output_style="compressed")
  File "C:\Python34\lib\site-packages\sass.py", line 509, in compile
    include_paths, precision, custom_functions,
  File "C:\Python34\lib\site-packages\sass.py", line 169, in compile_dirname
    output_file.write(v)
  File "C:\Python34\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\ufeff' in position
0: character maps to <undefined>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.