Skip to content

1.4.2 requires absolute paths support from static storage #403

Closed
@rjagielski

Description

@rjagielski

I'm using the following static storage:

class S3PipelineStorage(PipelineMixin, S3BotoStorage):
    """S3 storage with pipeline magic"""
    pass

Which is almost the same as the one from pipeline docs (even simpler because it doesnt use CachedFilesMixin) .
It's fine with 1.3.x but breaks with 1.4.2 because it tries to run sass compiler using absolute path from s3. S3BotoStorage doesn't support absolute paths and throws this long exception:

/home/bender/myapps/foo/manage.py in <module>()
      8     from django.core.management import execute_from_command_line
      9 
---> 10     execute_from_command_line(sys.argv)

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/django/core/management/__init__.pyc in execute_from_command_line(argv)
    383     """
    384     utility = ManagementUtility(argv)
--> 385     utility.execute()

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/django/core/management/__init__.pyc in execute(self)
    375             sys.stdout.write(self.main_help_text() + '\n')
    376         else:
--> 377             self.fetch_command(subcommand).run_from_argv(self.argv)
    378 
    379 

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/django/core/management/base.pyc in run_from_argv(self, argv)
    286         handle_default_options(options)
    287         try:
--> 288             self.execute(*args, **options.__dict__)
    289         except Exception as e:
    290             if options.traceback or not isinstance(e, CommandError):

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/django/core/management/base.pyc in execute(self, *args, **options)
    336                     not options.get('skip_checks')):
    337                 self.check()
--> 338             output = self.handle(*args, **options)
    339             if output:
    340                 if self.output_transaction:

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/django/core/management/base.pyc in handle(self, *args, **options)
    531         if args:
    532             raise CommandError("Command doesn't accept any arguments")
--> 533         return self.handle_noargs(**options)
    534 
    535     def handle_noargs(self, **options):

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.pyc in handle_noargs(self, **options)
    166             raise CommandError("Collecting static files cancelled.")
    167 
--> 168         collected = self.collect()
    169         modified_count = len(collected['modified'])
    170         unmodified_count = len(collected['unmodified'])

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.pyc in collect(self)
    112             processor = self.storage.post_process(found_files,
    113                                                   dry_run=self.dry_run)
--> 114             for original_path, processed_path, processed in processor:
    115                 if isinstance(processed, Exception):
    116                     self.stderr.write("Post-processing '%s' failed!" % original_path)
/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/pipeline/storage.pyc in post_process(self, paths, dry_run, **options)
     28         from pipeline.packager import Packager
     29         packager = Packager(storage=self)
---> 30         for package_name in packager.packages['css']:
     31             package = packager.package_for('css', package_name)
     32             output_file = package.output_filename

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/pipeline/packager.pyc in pack_stylesheets(self, package, **kwargs)
     94         return self.pack(package, self.compressor.compress_css, css_compressed,
     95                          output_filename=package.output_filename,
---> 96                          variant=package.variant, **kwargs)
     97 
     98     def compile(self, paths, force=False):

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/pipeline/packager.pyc in pack(self, package, compress, signal, **kwargs)
    103         if self.verbose:
    104             print("Saving: %s" % output_filename)
--> 105         paths = self.compile(package.paths, force=True)
    106         content = compress(paths, **kwargs)
    107         self.save_file(output_filename, content)

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/pipeline/packager.pyc in compile(self, paths, force)
     97 
     98     def compile(self, paths, force=False):
---> 99         return self.compiler.compile(paths, force=force)
    100 
    101     def pack(self, package, compress, signal, **kwargs):

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/pipeline/compilers/__init__.pyc in compile(self, paths, force)
     54         else:
     55             with futures.ThreadPoolExecutor(max_workers=multiprocessing.cpu_count()) as executor:
---> 56                 return list(executor.map(_compile, paths))
     57 
     58     def output_path(self, path, extension):

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/concurrent/futures/_base.pyc in map(self, fn, *iterables, **kwargs)
    578             for future in fs:
    579                 if timeout is None:
--> 580                     yield future.result()
    581                 else:
    582                     yield future.result(end_time - time.time())

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/concurrent/futures/_base.pyc in result(self, timeout)
    398                 raise CancelledError()
    399             elif self._state == FINISHED:
--> 400                 return self.__get_result()
    401 
    402             self._condition.wait(timeout)

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/concurrent/futures/_base.pyc in __get_result(self)
    357     def __get_result(self):
    358         if self._exception:
--> 359             reraise(self._exception, self._traceback)
    360         else:
    361             return self._result

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/concurrent/futures/_compat.pyc in reraise(exc, traceback)
    105     def reraise(exc, traceback):
    106         locals_ = {'exc_type': type(exc), 'exc_value': exc, 'traceback': traceback}
--> 107         exec('raise exc_type, exc_value, traceback', {}, locals_)
/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/concurrent/futures/thread.pyc in run(self)
     59 
     60         try:
---> 61             result = self.fn(*self.args, **self.kwargs)
     62         except BaseException:
     63             e, tb = sys.exc_info()[1:]

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/pipeline/compilers/__init__.pyc in _compile(input_path)
     34                 if compiler.match_file(input_path):
     35                     output_path = self.output_path(input_path, compiler.output_extension)
---> 36                     infile = self.storage.path(input_path)
     37                     outfile = self.output_path(infile, compiler.output_extension)
     38                     outdated = compiler.is_outdated(input_path, output_path)

/home/bender/.virtualenvs/foo/lib/python2.7/site-packages/django/core/files/storage.pyc in path(self, name)
     85         accessed using open() should *not* implement this method.
     86         """
---> 87         raise NotImplementedError("This backend doesn't support absolute paths.")
     88 
     89     # The following methods form the public API for storage systems, but with

NotImplementedError: This backend doesn't support absolute paths

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions