Commit b4333e45 by Sébastien Eustace

Fix sonnet script

parent d27ed443
...@@ -51,6 +51,7 @@ class MakeReleaseCommand(Command): ...@@ -51,6 +51,7 @@ class MakeReleaseCommand(Command):
from poetry.repositories.repository import Repository from poetry.repositories.repository import Repository
from poetry.utils._compat import Path from poetry.utils._compat import Path
from poetry.utils.helpers import temporary_directory from poetry.utils.helpers import temporary_directory
from poetry.vcs import get_vcs
project = Poetry.create(Path.cwd()) project = Poetry.create(Path.cwd())
package = project.package package = project.package
...@@ -60,11 +61,21 @@ class MakeReleaseCommand(Command): ...@@ -60,11 +61,21 @@ class MakeReleaseCommand(Command):
pool = Pool() pool = Pool()
pool.add_repository(project.locker.locked_repository(with_dev_reqs=True)) pool.add_repository(project.locker.locked_repository(with_dev_reqs=True))
vcs = get_vcs(Path(__file__).parent)
if vcs:
vcs_excluded = [str(f) for f in vcs.get_ignored_files()]
else:
vcs_excluded = []
with temporary_directory() as tmp_dir: with temporary_directory() as tmp_dir:
# Copy poetry to tmp dir # Copy poetry to tmp dir
poetry_dir = os.path.join(tmp_dir, "poetry") poetry_dir = os.path.join(tmp_dir, "poetry")
shutil.copytree( shutil.copytree(
os.path.join(os.path.dirname(__file__), "poetry"), poetry_dir os.path.join(os.path.dirname(__file__), "poetry"),
poetry_dir,
ignore=lambda dir_, names: set(vcs_excluded).intersection(
set([os.path.join(dir_, name) for name in names])
),
) )
for version, python in sorted(pythons.items()): for version, python in sorted(pythons.items()):
self.line( self.line(
...@@ -102,9 +113,14 @@ class MakeReleaseCommand(Command): ...@@ -102,9 +113,14 @@ class MakeReleaseCommand(Command):
continue continue
path = os.path.join(os.path.realpath(root), f) path = os.path.join(os.path.realpath(root), f)
relpath = os.path.relpath( relpath = os.path.relpath(
path, os.path.realpath(tmp_dir) path, os.path.realpath(tmp_dir)
) )
if relpath in vcs_excluded:
continue
tar_info = tar.gettarinfo(str(path), arcname=relpath) tar_info = tar.gettarinfo(str(path), arcname=relpath)
if tar_info.isreg(): if tar_info.isreg():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment