Aug 17

Preventing Spotify Crashes in the Linux Client Preview

This may only be relevant for Fedora users. Anyway, after I’ve ran the Spotify client preview for some time, it crashes without a good explanation why. After a crash the client won’t run again until the cache is cleared.

$ rm -rf ~/.cache/spotify

It’s likely that you can be more fine-grained when clearing the cache. I haven’t investigated it much, but it may be sufficient to remove ~/.cache/spotify/Storage. Note that the cache directory is configurable in Edit→Preferences….


Aug 16

Applying patches using SCons

A project has third-party dependencies that need to be patched before being used. I’m new to SCons, but here is my go at applying patches using the build tool.

site_scons/site_init.py

import os

def TOOL_VENDOR(env):
    def patch_generator(source, target, env, for_signature):
        """Generate a patched version of source in target (both being
        directories). If a patch is missing, do nothing.
        """
        target = target[0]
        source = source[0]
        patch_path = '%s.patch' % source.path
        cmds = []
        if len(Glob(patch_path)):
            cmds += [
                Delete(target),
                Copy(target, source),
                "cd %s && patch -p1 < %s" % (target.path, os.path.abspath(patch_path)),
                ]
        return cmds
    env.Append(BUILDERS = {'VendorPatch': Builder(generator=patch_generator)})

SConstruct

env = Environment(tools=['default', TOOL_VENDOR])
SConscript([
        'vendor/SConscript',
        ], exports='env')

vendor/ is a directory with third-party libraries. The vendor/SConscript file will

  1. find directories such as vendor/acme-parser/repo and create a patched version of it in vendor/acme-parser/patched, if vendor/acme-parser/repo.patch exists, and
  2. run any existing library SConscript files.

vendor/SConscript

Import('env')
import os

for repo in Glob('*/repo'):
    env.VendorPatch(Dir(os.path.join(repo.dir.name, 'patched')), repo)

SConscript(Glob('*/SConscript'), exports='env')

Aug 11

Solitary Man

Solitary Man

Great movie with awesome music.



Jun 27

Jun 14

Jun 12

Student 2010, Västermalm, Sundsvall


Jun 10
Nigera vs. Germany

Nigera vs. Germany


Jun 7
“People are more violently opposed to fur than leather because it’s safer to harass rich women than motorcycle gangs.” — Dave Barry

May 28
“Only white man dumb enough to think he could improve system like that.”

“Only white man dumb enough to think he could improve system like that.”




Simon Pantzare
Simon Pantzare, also available on
facebook,
twitter,
reddit,
github.
Ask me anything.