-
-
Notifications
You must be signed in to change notification settings - Fork 675
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove use of setup.py by using a proxied build backend.
- Loading branch information
1 parent
12d3fd2
commit 7839190
Showing
40 changed files
with
226 additions
and
133 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# PEP517 doesn't allow ".." in a build backend's `backend-path` setting. | ||
# To avoid duplicating the backend's code, insert ".." into sys.path, | ||
# then import the toga_builder. | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)))) | ||
from toga_builder import * # noqa: F401,E402,F403 |
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 was deleted.
Oops, something went wrong.
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,8 @@ | ||
# PEP517 doesn't allow ".." in a build backend's `backend-path` setting. | ||
# To avoid duplicating the backend's code, insert ".." into sys.path, | ||
# then import the toga_builder. | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)))) | ||
from toga_builder import * # noqa: F401,E402,F403 |
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 was deleted.
Oops, something went wrong.
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,23 @@ | ||
# A wrapper around setuptools that injects a dynamic dependency on toga. | ||
# It presents as a PEP517 build backend with the same interface as | ||
# setuptools.build_meta, but dynamically injects a modification to | ||
# `parse_config_files` that injects the extra dependency, using the version | ||
# number computed at runtime. | ||
from setuptools import dist | ||
from setuptools.build_meta import * # noqa: F401,F403 | ||
from setuptools_scm import get_version | ||
|
||
TOGA_VERSION = get_version(root="..") | ||
|
||
|
||
orig_parse_config_files = dist.Distribution.parse_config_files | ||
|
||
|
||
def parse_config_files(self, filenames=None, ignore_option_errors=False): | ||
orig_parse_config_files(self, filenames=None, ignore_option_errors=False) | ||
|
||
# Insert a dependency on toga at the same version as the repo. | ||
self.install_requires.insert(0, f"toga=={TOGA_VERSION}") | ||
|
||
|
||
dist.Distribution.parse_config_files = parse_config_files |
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 was deleted.
Oops, something went wrong.
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,8 @@ | ||
# PEP517 doesn't allow ".." in a build backend's `backend-path` setting. | ||
# To avoid duplicating the backend's code, insert ".." into sys.path, | ||
# then import the toga_builder. | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)))) | ||
from toga_builder import * # noqa: F401,E402,F403 |
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
[build-system] | ||
requires = ["setuptools==66.1.1", "setuptools_scm[toml]==7.0.5"] | ||
build-backend = "setuptools.build_meta" | ||
build-backend = "builder" | ||
backend-path = ["."] | ||
|
||
[tool.setuptools_scm] | ||
root = ".." |
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 was deleted.
Oops, something went wrong.
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,8 @@ | ||
# PEP517 doesn't allow ".." in a build backend's `backend-path` setting. | ||
# To avoid duplicating the backend's code, insert ".." into sys.path, | ||
# then import the toga_builder. | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)))) | ||
from toga_builder import * # noqa: F401,E402,F403 |
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 was deleted.
Oops, something went wrong.
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,8 @@ | ||
# PEP517 doesn't allow ".." in a build backend's `backend-path` setting. | ||
# To avoid duplicating the backend's code, insert ".." into sys.path, | ||
# then import the toga_builder. | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)))) | ||
from toga_builder import * # noqa: F401,E402,F403 |
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 was deleted.
Oops, something went wrong.
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,8 @@ | ||
# PEP517 doesn't allow ".." in a build backend's `backend-path` setting. | ||
# To avoid duplicating the backend's code, insert ".." into sys.path, | ||
# then import the toga_builder. | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)))) | ||
from toga_builder import * # noqa: F401,E402,F403 |
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 was deleted.
Oops, something went wrong.
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,29 @@ | ||
# A wrapper around setuptools that injects a dynamic dependency on toga. | ||
# | ||
# It presents as a PEP517 build backend with the same interface as | ||
# setuptools.build_meta, but dynamically injects a modification to | ||
# `parse_config_files` that injects the extra dependencies, using the | ||
# version number computed at runtime. | ||
from setuptools import dist | ||
from setuptools.build_meta import * # noqa: F401,F403 | ||
from setuptools_scm import get_version | ||
|
||
TOGA_VERSION = get_version(root="..") | ||
|
||
|
||
orig_parse_config_files = dist.Distribution.parse_config_files | ||
|
||
|
||
def parse_config_files(self, filenames=None, ignore_option_errors=False): | ||
orig_parse_config_files(self, filenames=None, ignore_option_errors=False) | ||
|
||
# Insert the per-platform extra dependencies with the same version as the | ||
self.extras_require = { | ||
':sys_platform=="win32"': [f"toga-winforms=={TOGA_VERSION}"], | ||
':sys_platform=="linux"': [f"toga-gtk=={TOGA_VERSION}"], | ||
':"freebsd" in sys_platform': [f"toga-gtk=={TOGA_VERSION}"], | ||
':sys_platform=="darwin"': [f"toga-cocoa=={TOGA_VERSION}"], | ||
} | ||
|
||
|
||
dist.Distribution.parse_config_files = parse_config_files |
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
[build-system] | ||
requires = ["setuptools==66.1.1", "setuptools_scm[toml]==7.0.5"] | ||
build-backend = "setuptools.build_meta" | ||
build-backend = "builder" | ||
backend-path = ["."] | ||
|
||
[tool.setuptools_scm] | ||
root = ".." |
Oops, something went wrong.