-
-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support build backends other than Hatchling (#1018)
- Loading branch information
Showing
7 changed files
with
129 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from hatch.env.internal.interface import InternalEnvironment | ||
|
||
|
||
def get_internal_environment_class(env_name: str) -> type[InternalEnvironment]: | ||
if env_name == 'build': | ||
from hatch.env.internal.build import InternalBuildEnvironment | ||
|
||
return InternalBuildEnvironment | ||
else: # no cov | ||
message = f'Unknown internal environment: {env_name}' | ||
raise ValueError(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from __future__ import annotations | ||
|
||
from hatch.env.internal.interface import InternalEnvironment | ||
|
||
|
||
class InternalBuildEnvironment(InternalEnvironment): | ||
def get_base_config(self) -> dict: | ||
return { | ||
'skip-install': True, | ||
'dependencies': ['build[virtualenv]>=1.0.3'], | ||
'scripts': { | ||
'build-all': 'python -m build', | ||
'build-sdist': 'python -m build --sdist', | ||
'build-wheel': 'python -m build --wheel', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from __future__ import annotations | ||
|
||
from functools import cached_property | ||
|
||
from hatch.env.virtual import VirtualEnvironment | ||
|
||
|
||
class InternalEnvironment(VirtualEnvironment): | ||
@cached_property | ||
def config(self) -> dict: | ||
config = {'type': 'virtual', 'template': self.name} | ||
config.update(self.get_base_config()) | ||
config.update(super().config) | ||
return config | ||
|
||
def get_base_config(self) -> dict: | ||
return {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters