Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita134f37

Browse files
committed
refactor: move const.incrementals into profiles.
The incrementals list is basically for profile data, evenif portage_conf and domain was written otherwise. Thusmove the list into profiles (out of const); this is inpreparation for eventually refactoring the incrementalconfiguration processing from portage_conf and domain intoa profile subclass so the logic is contained all there.Signed-off-by: Brian Harring <ferringb@gmail.com>
1 parent35c792f commita134f37

File tree

5 files changed

+31
-30
lines changed

5 files changed

+31
-30
lines changed

‎src/pkgcore/ebuild/const.py‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,6 @@
66

77
from ..constimportEBD_PATH
88

9-
incrementals= (
10-
"ACCEPT_KEYWORDS",
11-
"ACCEPT_LICENSE",
12-
"CONFIG_PROTECT",
13-
"CONFIG_PROTECT_MASK",
14-
"FEATURES",
15-
"IUSE_IMPLICIT",
16-
"PROFILE_ONLY_VARIABLES",
17-
"USE",
18-
"USE_EXPAND",
19-
"USE_EXPAND_HIDDEN",
20-
"USE_EXPAND_IMPLICIT",
21-
"USE_EXPAND_UNPREFIXED",
22-
"ENV_UNSET",
23-
)
249

2510
incrementals_unfinalized= ("USE",)
2611

‎src/pkgcore/ebuild/domain.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from ..restrictions.delegatedimportdelegate
4343
from ..util.parserestrictimportParseError,parse_match
4444
from .importconst
45+
from .profilesimportINCREMENTALS
4546
from .importrepositoryasebuild_repo
4647
from .atomimportatomas_atom
4748
from .eapiimportget_latest_PMS_eapi
@@ -319,7 +320,7 @@ def settings(self):
319320

320321
# reformat env.d and make.conf incrementals
321322
system_profile_settings= {}
322-
forxinconst.incrementals:
323+
forxinINCREMENTALS:
323324
system_profile_val=self.system_profile.get(x, ())
324325
make_conf_val=settings.get(x, ())
325326
ifisinstance(system_profile_val,str):
@@ -336,11 +337,11 @@ def settings(self):
336337
ifknotinsettings:
337338
settings[k]=v
338339
continue
339-
ifkinconst.incrementals:
340+
ifkinINCREMENTALS:
340341
settings[k]=system_profile_settings[k]+v+settings[k]
341342

342343
# next we finalize incrementals.
343-
forincrementalinconst.incrementals:
344+
forincrementalinINCREMENTALS:
344345
# Skip USE/ACCEPT_LICENSE for the time being; hack; we need the
345346
# negations currently so that pkg iuse induced enablings can be
346347
# disabled by negations. For example, think of the profile doing

‎src/pkgcore/ebuild/portage_conf.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def load_make_conf(
308308
return
309309

310310
ifincrementals:
311-
forkeyineconst.incrementals:
311+
forkeyinprofiles.INCREMENTALS:
312312
ifkeyinvars_dictandkeyinnew_vars:
313313
new_vars[key]=f"{vars_dict[key]}{new_vars[key]}"
314314
# quirk of read_bash_dict; it returns only what was mutated.

‎src/pkgcore/ebuild/profiles.py‎

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@
2929
from .atomimportatom
3030
from .eapiimportEAPI,get_eapi
3131

32+
INCREMENTALS= (
33+
"ACCEPT_KEYWORDS",
34+
"ACCEPT_LICENSE",
35+
"CONFIG_PROTECT",
36+
"CONFIG_PROTECT_MASK",
37+
"FEATURES",
38+
"IUSE_IMPLICIT",
39+
"PROFILE_ONLY_VARIABLES",
40+
"USE",
41+
"USE_EXPAND",
42+
"USE_EXPAND_HIDDEN",
43+
"USE_EXPAND_IMPLICIT",
44+
"USE_EXPAND_UNPREFIXED",
45+
"ENV_UNSET",
46+
)
3247

3348
classProfileError(errors.ParsingError):
3449
def__init__(self,path,filename,error):
@@ -157,7 +172,7 @@ def _load_and_invoke(
157172
)frome
158173

159174

160-
_make_incrementals_dict=partial(misc.IncrementalsDict,const.incrementals)
175+
_make_incrementals_dict=partial(misc.IncrementalsDict,INCREMENTALS)
161176
_Packages=namedtuple("_Packages", ("system","profile"))
162177

163178

@@ -703,7 +718,7 @@ def _collapse_generic(self, attr, clear=False):
703718
@klass.jit_attr
704719
defdefault_env(self):
705720
d=dict(self.node.default_env.items())
706-
forincrementalinconst.incrementals:
721+
forincrementalinINCREMENTALS:
707722
v=d.pop(incremental,"").split()
708723
ifv:
709724
ifincrementalinconst.incrementals_unfinalized:
@@ -718,14 +733,14 @@ def default_env(self):
718733

719734
@property
720735
defprofile_only_variables(self):
721-
if"PROFILE_ONLY_VARIABLES"inconst.incrementals:
736+
if"PROFILE_ONLY_VARIABLES"inINCREMENTALS:
722737
returnfrozenset(self.default_env.get("PROFILE_ONLY_VARIABLES", ()))
723738
returnfrozenset(self.default_env.get("PROFILE_ONLY_VARIABLES","").split())
724739

725740
@klass.jit_attr
726741
defuse_expand(self):
727742
"""USE_EXPAND variables defined by the profile."""
728-
if"USE_EXPAND"inconst.incrementals:
743+
if"USE_EXPAND"inINCREMENTALS:
729744
returnfrozenset(self.default_env.get("USE_EXPAND", ()))
730745
returnfrozenset(self.default_env.get("USE_EXPAND","").split())
731746

@@ -750,25 +765,25 @@ def expand_use(self, env=None):
750765

751766
@property
752767
defuse_expand_hidden(self):
753-
if"USE_EXPAND_HIDDEN"inconst.incrementals:
768+
if"USE_EXPAND_HIDDEN"inINCREMENTALS:
754769
returnfrozenset(self.default_env.get("USE_EXPAND_HIDDEN", ()))
755770
returnfrozenset(self.default_env.get("USE_EXPAND_HIDDEN","").split())
756771

757772
@property
758773
defiuse_implicit(self):
759-
if"IUSE_IMPLICIT"inconst.incrementals:
774+
if"IUSE_IMPLICIT"inINCREMENTALS:
760775
returnfrozenset(self.default_env.get("IUSE_IMPLICIT", ()))
761776
returnfrozenset(self.default_env.get("IUSE_IMPLICIT","").split())
762777

763778
@property
764779
defuse_expand_implicit(self):
765-
if"USE_EXPAND_IMPLICIT"inconst.incrementals:
780+
if"USE_EXPAND_IMPLICIT"inINCREMENTALS:
766781
returnfrozenset(self.default_env.get("USE_EXPAND_IMPLICIT", ()))
767782
returnfrozenset(self.default_env.get("USE_EXPAND_IMPLICIT","").split())
768783

769784
@property
770785
defuse_expand_unprefixed(self):
771-
if"USE_EXPAND_UNPREFIXED"inconst.incrementals:
786+
if"USE_EXPAND_UNPREFIXED"inINCREMENTALS:
772787
returnfrozenset(self.default_env.get("USE_EXPAND_UNPREFIXED", ()))
773788
returnfrozenset(self.default_env.get("USE_EXPAND_UNPREFIXED","").split())
774789

‎tests/ebuild/test_profiles.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ def test_default_env(self, tmp_path):
730730
assertself.klass(child).default_env== {"y":"narf","x":"narf twice"}
731731

732732
deftest_default_env_incrementals(self,tmp_path):
733-
assert"USE"inconst.incrementals
733+
assert"USE"inprofiles.INCREMENTALS
734734
profile1=tmp_path/self.profile
735735
(profile2:=profile1/"sub").mkdir()
736736
(profile3:=profile2/"sub").mkdir()
@@ -1645,8 +1645,8 @@ def test_pkg_use(self, tmp_path):
16451645

16461646
deftest_default_env(self,tmp_path):
16471647
assert"USE"inconst.incrementals_unfinalized
1648-
assert"USE"inconst.incrementals
1649-
assert"USE_EXPAND"inconst.incrementals
1648+
assert"USE"inprofiles.INCREMENTALS
1649+
assert"USE_EXPAND"inprofiles.INCREMENTALS
16501650

16511651
# first, verify it behaves correctly for unfinalized incrementals.
16521652
self.mk_profiles(tmp_path, {})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp