Repository: python-poetry/poetry

Issue:
Excluding file with unsupported VCS
<!-- Checked checkbox should look like this: [x] -->
- [x] I am on the [latest](https://github.com/sdispater/poetry/releases/latest) Poetry version.
- [x] I have searched the [issues](https://github.com/sdispater/poetry/issues) of this repo and believe that this is not a duplicate.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).

- **OS version and name**: Fedora 28
- **Poetry version**: 0.12.5
- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: https://gist.github.com/Lothiraldan/7e4c1ffde3ed90ec183ad4eb5e72a44c

## Issue
<!-- Now feel free to write your issue, but please be descriptive! Thanks again 🙌 ❤️ -->

Hello, first thank you for your work on poetry, packaging in Python is something we should be better at and poetry looks very promising.

I'm trying to use poetry with one of my project https://github.com/lothiraldan/balto which will include a compiled react project. I develop the project using Mercurial and then export the repository to Github.

The first time I ran `poetry build`, I saw that the nodes_modules directory was included so I try explictly excluding it with:

```toml
[tool.poetry]
exclude = ["balto/web_interfaces/balto_react/node_modules/**/*"]
```

But it didn't help.

I start taking a look at the code and found that the `find_excluded_files` early abort in case it didn't find the VCS (in my case Mercurial). Apart from adding Mercurial support (which I may do in the future), I think excluding files shouldn't depend on projects using a supported VCS.

I applied the following diff locally to still reads the explicitely excluded files that did the trick:

```diff
diff --git a/poetry/masonry/builders/builder.py b/poetry/masonry/builders/builder.py
index 627e006..477ec8d 100644
--- a/poetry/masonry/builders/builder.py
+++ b/poetry/masonry/builders/builder.py
@@ -43,14 +43,16 @@ class Builder(object):
         # Checking VCS
         vcs = get_vcs(self._path)
         if not vcs:
-            return []
+            vcs_ignored_files = []
+        else:
+            vcs_ignored_files = vcs.get_ignored_files()
 
         explicitely_excluded = []
         for excluded_glob in self._package.exclude:
             for excluded in self._path.glob(excluded_glob):
                 explicitely_excluded.append(excluded)
 
-        ignored = vcs.get_ignored_files() + explicitely_excluded
+        ignored = vcs_ignored_files + explicitely_excluded
         result = []
         for file in ignored:
             try:
```

I can send a PR with it if the code looks correct and the behavior change is ok.


Discussion:
Nice catch!

The patch looks good to me so feel free to make a PR and I'd gladly review it.

Resolving patch:
diff --git a/poetry/masonry/builders/builder.py b/poetry/masonry/builders/builder.py
--- a/poetry/masonry/builders/builder.py
+++ b/poetry/masonry/builders/builder.py
@@ -43,14 +43,16 @@ def find_excluded_files(self):  # type: () -> list
         # Checking VCS
         vcs = get_vcs(self._path)
         if not vcs:
-            return []
+            vcs_ignored_files = []
+        else:
+            vcs_ignored_files = vcs.get_ignored_files()
 
         explicitely_excluded = []
         for excluded_glob in self._package.exclude:
             for excluded in self._path.glob(excluded_glob):
                 explicitely_excluded.append(excluded)
 
-        ignored = vcs.get_ignored_files() + explicitely_excluded
+        ignored = vcs_ignored_files + explicitely_excluded
         result = []
         for file in ignored:
             try:


Test patch:
diff --git a/tests/masonry/builders/fixtures/complete/my_package/sub_pkg1/extra_file.xml b/tests/masonry/builders/fixtures/complete/my_package/sub_pkg1/extra_file.xml
new file mode 100644
diff --git a/tests/masonry/builders/fixtures/complete/pyproject.toml b/tests/masonry/builders/fixtures/complete/pyproject.toml
--- a/tests/masonry/builders/fixtures/complete/pyproject.toml
+++ b/tests/masonry/builders/fixtures/complete/pyproject.toml
@@ -20,6 +20,10 @@ classifiers = [
     "Topic :: Software Development :: Libraries :: Python Modules"
 ]
 
+exclude = [
+    "**/*.xml"
+]
+
 # Requirements
 [tool.poetry.dependencies]
 python = "^3.6"
diff --git a/tests/masonry/builders/test_complete.py b/tests/masonry/builders/test_complete.py
--- a/tests/masonry/builders/test_complete.py
+++ b/tests/masonry/builders/test_complete.py
@@ -7,6 +7,7 @@
 import sys
 import tarfile
 import zipfile
+import tempfile
 
 from poetry import __version__
 from poetry.io import NullIO
@@ -164,6 +165,105 @@ def test_complete():
         zip.close()
 
 
+def test_complete_no_vcs():
+    # Copy the complete fixtures dir to a temporary directory
+    module_path = fixtures_dir / "complete"
+    temporary_dir = Path(tempfile.mkdtemp()) / "complete"
+
+    shutil.copytree(module_path.as_posix(), temporary_dir.as_posix())
+
+    builder = CompleteBuilder(
+        Poetry.create(temporary_dir), NullEnv(execute=True), NullIO()
+    )
+    builder.build()
+
+    whl = temporary_dir / "dist" / "my_package-1.2.3-py3-none-any.whl"
+
+    assert whl.exists()
+
+    zip = zipfile.ZipFile(str(whl))
+
+    # Check the zipped file to be sure that included and excluded files are
+    # correctly taken account of without vcs
+    expected_name_list = [
+        "my_package/__init__.py",
+        "my_package/data1/test.json",
+        "my_package/sub_pkg1/__init__.py",
+        "my_package/sub_pkg2/__init__.py",
+        "my_package/sub_pkg2/data2/data.json",
+        "my_package-1.2.3.dist-info/entry_points.txt",
+        "my_package-1.2.3.dist-info/LICENSE",
+        "my_package-1.2.3.dist-info/WHEEL",
+        "my_package-1.2.3.dist-info/METADATA",
+        "my_package-1.2.3.dist-info/RECORD",
+    ]
+
+    assert sorted(zip.namelist()) == sorted(expected_name_list)
+
+    try:
+        entry_points = zip.read("my_package-1.2.3.dist-info/entry_points.txt")
+
+        assert (
+            decode(entry_points.decode())
+            == """\
+[console_scripts]
+extra-script=my_package.extra:main[time]
+my-2nd-script=my_package:main2
+my-script=my_package:main
+
+"""
+        )
+        wheel_data = decode(zip.read("my_package-1.2.3.dist-info/WHEEL"))
+
+        assert (
+            wheel_data
+            == """\
+Wheel-Version: 1.0
+Generator: poetry {}
+Root-Is-Purelib: true
+Tag: py3-none-any
+""".format(
+                __version__
+            )
+        )
+        wheel_data = decode(zip.read("my_package-1.2.3.dist-info/METADATA"))
+
+        assert (
+            wheel_data
+            == """\
+Metadata-Version: 2.1
+Name: my-package
+Version: 1.2.3
+Summary: Some description.
+Home-page: https://poetry.eustace.io/
+License: MIT
+Keywords: packaging,dependency,poetry
+Author: Sébastien Eustace
+Author-email: sebastien@eustace.io
+Requires-Python: >=3.6,<4.0
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Topic :: Software Development :: Build Tools
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Provides-Extra: time
+Requires-Dist: cachy[msgpack] (>=0.2.0,<0.3.0)
+Requires-Dist: cleo (>=0.6,<0.7)
+Requires-Dist: pendulum (>=1.4,<2.0); extra == "time"
+Project-URL: Documentation, https://poetry.eustace.io/docs
+Project-URL: Repository, https://github.com/sdispater/poetry
+Description-Content-Type: text/x-rst
+
+My Package
+==========
+
+"""
+        )
+    finally:
+        zip.close()
+
+
 def test_module_src():
     module_path = fixtures_dir / "source_file"
     builder = CompleteBuilder(