I’m setting up django-compress, and incredibly helpful django tool for compressing media files. By default it requires the installation of CSSTidy which was not as smooth of a task as most. Here are my notes.
Installing Scons
To install CSSTidy you have to have Scons in order to install it. Scons is similar to Make but uses python and probably has a ton of other differences as well. The following will install scons.
wget http://prdownloads.sourceforge.net/scons/scons-1.2.0.tar.gz tar -xzvf scons-1.2.0.tar.gz cd scons-1.2.0 sudo python setup.py install --standard-lib
I took me a short while to discover the need to use the –standard-lib flag. If you do not scons is not installed in the python path and you will get the following error when trying to install csstidy
scons: *** No SConstruct file found.
File “/usr/local/lib/scons-1.2.0/SCons/Script/Main.py”, line 826, in _main
Install CSSTidy
wget http://downloads.sourceforge.net/csstidy/csstidy-source-1.4.zip?modtime=1184828155&big_mirror=0 unzip csstidy-source-1.4.zip scons sudo cp release/csstidy/csstidy /usr/local/bin/
Note that the last command assumes /usr/local/bin is in your $PATH. Change it if you would like to place it in another place.
Posted by justin heideman on June 8, 2009 at 10:34 am
Thanks for sharing, this was very helpful.
I did run into a little issue installing csstidy. When I ran `scons` in the unzipped csstidy dir, I got this error:
Traceback (most recent call last): File "/usr/local/bin/scons", line 162, in import SCons.Script ImportError: No module named SCons.ScriptI went back to the untarred scons folder and installed it again, this time ommitting the –standard-lib arg, which worked fine. Then I went back to the csstidy dir and re-ran scons, and csstidy installed without issue.
Posted by Dave on June 28, 2009 at 5:55 pm
Hi Dave.
(For others who land here….)
Just a little correction to your OSX SCons install instruction. It should be:
sudo python setup.py install –standard-lib
(2 dashes, not 1, before standard-lib)
This instruction is in the README.txt file.
ciao, D.
Posted by Dave on June 28, 2009 at 5:58 pm
Oh I see the problem. Your blog site seems to remove the second ‘-’ before the “standard-lib”
D.
Posted by godavemon on June 28, 2009 at 6:07 pm
Thanks for leaving the note. WordPress sometimes takes extra liberties with the text
.
I’ve updated to wrap the lines in tags, so it won’t be an issue anymore. Thanks again.
Posted by Matt on September 19, 2009 at 3:20 pm
As Bryan pointed out on Stack Overflow, the third step under Install CSSTidy – “cd csstidy” – should be removed. Otherwise you keep getting the error everyone is having above.
http://stackoverflow.com/questions/1223647/csstidy-is-driving-me-crazy
Thanks to everyone involved! This was very helpful.
Posted by Keith on April 14, 2010 at 12:11 pm
+1 to Matt/Bryan
Don’t “cd csstidy”
Posted by Kurt Milam on August 27, 2010 at 5:49 am
Thanks for the instructions.
You should remove the
cd csstidyinstruction – you have to run scons from the directory that contains SConstruct, and following your directions, SConstruct is in ../csstidy , not in ./csstidy.Hopefully that’ll be helpful to someone else who’s trying this out.
Kurt
Posted by madr.se uppmärksammar – vecka 3 | madr.se on November 14, 2010 at 5:15 pm
[...] Installing CSSTidy and Scons on OS X or Linux « ThingsILearned [...]
Posted by felix on March 29, 2011 at 2:51 pm
at least for me SCons failed to install itself correctly as shown above.
it put the folder scons-1.2.0-py2.6.egg into site_packages
but then inside that is a useless folder scons-1.2.0
and the actual SCons folder/module is below that so python cannot even see it. its not on the path at all ! its one folder too deep
I rearranged the contents of the egg and now it works.
Posted by nerdiacs (@nerdiacs) on September 10, 2011 at 6:39 am
That was pretty nice solution. I had same problem where I got Scons via easy_install on my OSX Python 2.6
Posted by Colin Viebrock on November 18, 2011 at 11:32 am
Trying this under Lion. I got scons installed fine, but when I go to build CSSTidy, I get:
cmv$ scons
scons: Reading SConscript files …
**** Compiling in release mode…
scons: warning: The env.Copy() method is deprecated; use the env.Clone() method instead.
File “/Users/cmv/Downloads/csstidy-source-1.4/csstidy/SConscript”, line 7, in
scons: warning: BuildDir() and the build_dir keyword have been deprecated;
use VariantDir() and the variant_dir keyword instead.
File “/Users/cmv/Downloads/csstidy-source-1.4/csstidy/SConscript”, line 21, in
scons: done reading SConscript files.
scons: Building targets …
o release/csstidy/background.o -c -O2 csstidy/background.cpp
sh: o: command not found
…
It seems like it’s trying to use “o” for my compiler. Any ideas?