diff --git a/poetry/core/packages/directory_dependency.py b/poetry/core/packages/directory_dependency.py index e40e6b3b8..128d46738 100644 --- a/poetry/core/packages/directory_dependency.py +++ b/poetry/core/packages/directory_dependency.py @@ -1,6 +1,7 @@ from typing import List from typing import Set from typing import Union +from warnings import warn from poetry.core.pyproject import PyProjectTOML from poetry.core.utils._compat import Path @@ -17,6 +18,7 @@ def __init__( optional=False, # type: bool base=None, # type: Path editable=False, # type: bool + develop=False, # type: bool extras=None, # type: Union[List[str], Set[str]] ): self._path = path @@ -29,7 +31,18 @@ def __init__( except FileNotFoundError: raise ValueError("Directory {} does not exist".format(self._path)) - self._editable = editable + # TODO: Remove the following once poetry has been updated to use editable in source. + if develop: + if editable: + raise ValueError( + 'Deprecated "develop" parameter may not be passed with new "editable" parameter. ' + 'Only use "editable"!' + ) + warn( + '"develop" parameter is deprecated, use "editable" instead.', + DeprecationWarning, + ) + self._editable = editable or develop self._supports_poetry = False if not self._full_path.exists(): @@ -78,6 +91,15 @@ def base(self): def editable(self): return self._editable + # TODO: Remove the following once poetry has been updated to use editable in source. + @property + def develop(self): # type: () -> bool + warn( + '"develop" property is deprecated, use "editable" instead.', + DeprecationWarning, + ) + return self.editable + def supports_poetry(self): return self._supports_poetry diff --git a/poetry/core/packages/package.py b/poetry/core/packages/package.py index 0721826ca..dd8e5f9ed 100644 --- a/poetry/core/packages/package.py +++ b/poetry/core/packages/package.py @@ -4,6 +4,7 @@ from contextlib import contextmanager from typing import List +from warnings import warn from poetry.core.semver import Version from poetry.core.semver import parse_constraint @@ -287,6 +288,24 @@ def urls(self): return urls + # TODO: Remove the following once poetry has been updated to use editable in source. + @property + def develop(self): # type: () -> bool + warn( + '"develop" attribute is deprecated, use "editable" instead.', + DeprecationWarning, + ) + return self.editable + + # TODO: Remove the following once poetry has been updated to use editable in source. + @develop.setter + def develop(self, value): # type: (bool) -> None + warn( + '"develop" attribute is deprecated, use "editable" instead.', + DeprecationWarning, + ) + self.editable = value + def is_prerelease(self): return self._version.is_prerelease() diff --git a/poetry/core/packages/vcs_dependency.py b/poetry/core/packages/vcs_dependency.py index e2ead7a0c..79c54f841 100644 --- a/poetry/core/packages/vcs_dependency.py +++ b/poetry/core/packages/vcs_dependency.py @@ -1,6 +1,7 @@ from typing import List from typing import Set from typing import Union +from warnings import warn from poetry.core.vcs import git @@ -24,6 +25,7 @@ def __init__( category="main", optional=False, editable=False, + develop=False, extras=None, # type: Union[List[str], Set[str]] ): self._vcs = vcs @@ -36,6 +38,17 @@ def __init__( self._branch = branch self._tag = tag self._rev = rev + # TODO: Remove the following once poetry has been updated to use editable in source. + if develop: + if editable: + raise ValueError( + 'Deprecated "develop" parameter may not be passed with new "editable" parameter. ' + 'Only use "editable"!' + ) + warn( + '"develop" parameter is deprecated, use "editable" instead.', + DeprecationWarning, + ) self._editable = editable super(VCSDependency, self).__init__( @@ -75,6 +88,15 @@ def rev(self): def editable(self): # type: () -> bool return self._editable + # TODO: Remove the following once poetry has been updated to use editable in source. + @property + def develop(self): # type: () -> bool + warn( + '"develop" property is deprecated, use "editable" instead.', + DeprecationWarning, + ) + return self.editable + @property def reference(self): # type: () -> str return self._branch or self._tag or self._rev