Skip to content

Better support for .dockerignore #721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2015
Merged

Better support for .dockerignore #721

merged 1 commit into from
Aug 26, 2015

Conversation

aanand
Copy link
Contributor

@aanand aanand commented Aug 18, 2015

Builds on @mikexstudios' work in #604, with fixes for Python 2.6 and some refactoring.

Still waiting on version 0.3.4 of pathspec, though - any word on that, @cpburnz?

@aanand aanand changed the title Pathspec Better support for .dockerignore Aug 18, 2015
@aanand
Copy link
Contributor Author

aanand commented Aug 18, 2015

Test setup is failing for Python 3.2 on this line, which is odd.

  Cloning git://github.com/cpburnz/python-path-specification.git to ./.tox/py32/src/pathspec
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/home/travis/build/docker/docker-py/.tox/py32/src/pathspec/setup.py", line 6, in <module>
        from pathspec import __author__, __email__, __license__, __project__, __version__
      File "pathspec/__init__.py", line 11
        __copyright__ = u"Copyright © 2013-2015 Caleb P. Burns"
                                                               ^
    SyntaxError: invalid syntax

@cpburnz
Copy link

cpburnz commented Aug 22, 2015

@aanand The syntax error is due to Python 3.0–3.2 not supporting explicit unicode literals which were re-added to Python 3.3 with PEP 0414.

@cpburnz
Copy link

cpburnz commented Aug 24, 2015

@aanand The Python 3.2 syntax error has been fixed and pathspec 0.3.4 has been released.

@aanand
Copy link
Contributor Author

aanand commented Aug 26, 2015

OK, after some investigation it turns out that pathspec isn't right for us. .dockerignore's syntax and semantics are dramatically different from .gitignores.

I've written a fairly comprehensive test suite that covers the correct behaviour (which I confirmed was correct by testing it against actual docker build invocations), and updated the code accordingly. There are no new external dependencies.

Here's what's new:

This is ready for review.

@aanand
Copy link
Contributor Author

aanand commented Aug 26, 2015

@cpburnz thanks for responding, by the way, and sorry we didn't end up using your library in the end!

- Support all basic pattern forms: file, directory, *, ?, !

- Fix handling of wildcard patterns and subdirectories - `*/a.py` should
  match `foo/a.py`, but not `foo/bar/a.py`

- Fix handling of directory patterns with a trailing slash - make sure
  they're handled equivalently to those without one

- Fix handling of custom Dockerfiles - make sure they go in the tarball

Signed-off-by: Aanand Prasad <[email protected]>
@aanand
Copy link
Contributor Author

aanand commented Aug 26, 2015

Fixed the build.

@shin-
Copy link
Contributor

shin- commented Aug 26, 2015

LGTM - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants