Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.buildout
Commits
12fd6175
Commit
12fd6175
authored
May 15, 2020
by
Godefroid Chapelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: default.cfg tests broken under Windows
Solution: pass environment properly, pass USERPROFILE
parent
58346265
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
15 deletions
+47
-15
.github/workflows/tests-on-runners.yml
.github/workflows/tests-on-runners.yml
+5
-0
src/zc/buildout/buildout.txt
src/zc/buildout/buildout.txt
+33
-11
src/zc/buildout/extends-cache.txt
src/zc/buildout/extends-cache.txt
+4
-1
src/zc/buildout/testing.py
src/zc/buildout/testing.py
+5
-3
No files found.
.github/workflows/tests-on-runners.yml
View file @
12fd6175
...
@@ -22,6 +22,11 @@ jobs:
...
@@ -22,6 +22,11 @@ jobs:
uses
:
actions/setup-python@v2
uses
:
actions/setup-python@v2
with
:
with
:
python_version
:
${{ matrix.python_version }}
python_version
:
${{ matrix.python_version }}
-
name
:
Cache eggs
uses
:
actions/cache@v1.2.0
with
:
path
:
eggs
key
:
${{ matrix.os }}-{{ matrix.python_version }}-eggs
-
name
:
Install dev environment
-
name
:
Install dev environment
run
:
|
run
:
|
python dev.py
python dev.py
...
...
src/zc/buildout/buildout.txt
View file @
12fd6175
...
@@ -1130,6 +1130,26 @@ allow us to see interactions with the buildout::
...
@@ -1130,6 +1130,26 @@ allow us to see interactions with the buildout::
... update = install
... update = install
... """)
... """)
>>> write(sample_buildout, 'recipes', 'environ.py',
... """
... import sys
... import os
... class Environ:
...
... def __init__(self, buildout, name, options):
... self.buildout = buildout
... self.options = options
...
... def install(self):
... _ = self.options['name']
... sys.stdout.write('HOME %s\\n' % os.environ['HOME'])
... sys.stdout.write('USERPROFILE %s\\n' % os.environ['USERPROFILE'])
... sys.stdout.write('expanduser %s\\n' % os.path.expanduser('~'))
... return ()
...
... update = install
... """)
This recipe doesn't actually create anything. The install method
This recipe doesn't actually create anything. The install method
doesn't return anything, because it didn't create any files or
doesn't return anything, because it didn't create any files or
directories.
directories.
...
@@ -1144,6 +1164,7 @@ We also have to update our setup script::
...
@@ -1144,6 +1164,7 @@ We also have to update our setup script::
... [zc.buildout]
... [zc.buildout]
... mkdir = mkdir:Mkdir
... mkdir = mkdir:Mkdir
... debug = debug:Debug
... debug = debug:Debug
... environ = environ:Environ
... ''')
... ''')
... setup(name="recipes", entry_points=entry_points)
... setup(name="recipes", entry_points=entry_points)
... """)
... """)
...
@@ -1846,6 +1867,10 @@ Here is a more elaborate example::
...
@@ -1846,6 +1867,10 @@ Here is a more elaborate example::
... [debug]
... [debug]
... recipe = recipes:debug
... recipe = recipes:debug
... name = base
... name = base
...
... [environ]
... recipe = recipes:environ
... name = base
... """)
... """)
>>> print_(system(buildout), end='')
>>> print_(system(buildout), end='')
...
@@ -1971,18 +1996,18 @@ reading the configuration file. (``$HOME`` is the value of the ``HOME``
...
@@ -1971,18 +1996,18 @@ reading the configuration file. (``$HOME`` is the value of the ``HOME``
environment variable. The ``/`` is replaced by the operating system file
environment variable. The ``/`` is replaced by the operating system file
delimiter.)::
delimiter.)::
>>> old_home = os.environ['HOME']
>>> home = tmpdir('home')
>>> home = tmpdir('home')
>>> mkdir(home, '.buildout')
>>> mkdir(home, '.buildout')
>>> write(home, '.buildout', 'default.cfg',
>>> default_cfg = join(home, '.buildout', 'default.cfg')
>>> write(default_cfg,
... """
... """
... [debug]
... [debug]
... op1 = 1
... op1 = 1
... op7 = 7
... op7 = 7
... """)
... """)
>>>
os.environ['HOME'] = home
>>>
env = dict(HOME=home, USERPROFILE=home)
>>> print_(system(buildout), end='')
>>> print_(system(buildout
, env=env
), end='')
Develop: '/sample-buildout/recipes'
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Uninstalling debug.
Installing debug.
Installing debug.
...
@@ -1999,7 +2024,7 @@ delimiter.)::
...
@@ -1999,7 +2024,7 @@ delimiter.)::
A buildout command-line argument, ``-U``, can be used to suppress reading
A buildout command-line argument, ``-U``, can be used to suppress reading
user defaults::
user defaults::
>>> print_(system(buildout + ' -U'), end='')
>>> print_(system(buildout + ' -U'
, env=env
), end='')
Develop: '/sample-buildout/recipes'
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Uninstalling debug.
Installing debug.
Installing debug.
...
@@ -2026,8 +2051,8 @@ appropriate set of defaults::
...
@@ -2026,8 +2051,8 @@ appropriate set of defaults::
... op8 = eight!
... op8 = eight!
... """)
... """)
>>>
os.environ
['BUILDOUT_HOME'] = alterhome
>>>
env
['BUILDOUT_HOME'] = alterhome
>>> print_(system(buildout), end='')
>>> print_(system(buildout
, env=env
), end='')
Develop: '/sample-buildout/recipes'
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Uninstalling debug.
Installing debug.
Installing debug.
...
@@ -2045,7 +2070,7 @@ appropriate set of defaults::
...
@@ -2045,7 +2070,7 @@ appropriate set of defaults::
The ``-U`` argument still suppresses reading of the ``default.cfg`` file from
The ``-U`` argument still suppresses reading of the ``default.cfg`` file from
``BUILDOUT_HOME``::
``BUILDOUT_HOME``::
>>> print_(system(buildout + ' -U'), end='')
>>> print_(system(buildout + ' -U'
, env=env
), end='')
Develop: '/sample-buildout/recipes'
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Uninstalling debug.
Installing debug.
Installing debug.
...
@@ -2058,9 +2083,6 @@ The ``-U`` argument still suppresses reading of the ``default.cfg`` file from
...
@@ -2058,9 +2083,6 @@ The ``-U`` argument still suppresses reading of the ``default.cfg`` file from
op5 b3base 5
op5 b3base 5
recipe recipes:debug
recipe recipes:debug
>>> os.environ['HOME'] = old_home
>>> del os.environ['BUILDOUT_HOME']
Log level
Log level
---------
---------
...
...
src/zc/buildout/extends-cache.txt
View file @
12fd6175
...
@@ -174,7 +174,10 @@ bases, using different caches:
...
@@ -174,7 +174,10 @@ bases, using different caches:
>>> mkdir('home', '.buildout')
>>> mkdir('home', '.buildout')
>>> mkdir('cache')
>>> mkdir('cache')
>>> mkdir('user-cache')
>>> mkdir('user-cache')
>>> os.environ['HOME'] = join(sample_buildout, 'home')
>>> home=join(sample_buildout, 'home')
>>> env=dict(HOME=home, USERPROFILE=home)
>>> import functools
>>> system = functools.partial(system, env=env)
>>> write('home', '.buildout', 'default.cfg', """\
>>> write('home', '.buildout', 'default.cfg', """\
... [buildout]
... [buildout]
... extends = fancy_default.cfg
... extends = fancy_default.cfg
...
...
src/zc/buildout/testing.py
View file @
12fd6175
...
@@ -125,12 +125,14 @@ def clean_up_pyc(*path):
...
@@ -125,12 +125,14 @@ def clean_up_pyc(*path):
## FIXME - check for other platforms
## FIXME - check for other platforms
MUST_CLOSE_FDS
=
not
sys
.
platform
.
startswith
(
'win'
)
MUST_CLOSE_FDS
=
not
sys
.
platform
.
startswith
(
'win'
)
def
system
(
command
,
input
=
''
,
with_exit_code
=
False
):
def
system
(
command
,
input
=
''
,
with_exit_code
=
False
,
env
=
None
):
# Some TERMinals, especially xterm and its variants, add invisible control
# Some TERMinals, especially xterm and its variants, add invisible control
# characters, which we do not want as they mess up doctests. See:
# characters, which we do not want as they mess up doctests. See:
# https://github.com/buildout/buildout/pull/311
# https://github.com/buildout/buildout/pull/311
# http://bugs.python.org/issue19884
# http://bugs.python.org/issue19884
env
=
dict
(
os
.
environ
,
TERM
=
'dumb'
)
sub_env
=
dict
(
os
.
environ
,
TERM
=
'dumb'
)
if
env
is
not
None
:
sub_env
.
update
(
env
)
p
=
subprocess
.
Popen
(
command
,
p
=
subprocess
.
Popen
(
command
,
shell
=
True
,
shell
=
True
,
...
@@ -138,7 +140,7 @@ def system(command, input='', with_exit_code=False):
...
@@ -138,7 +140,7 @@ def system(command, input='', with_exit_code=False):
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
close_fds
=
MUST_CLOSE_FDS
,
close_fds
=
MUST_CLOSE_FDS
,
env
=
env
)
env
=
sub_
env
)
i
,
o
,
e
=
(
p
.
stdin
,
p
.
stdout
,
p
.
stderr
)
i
,
o
,
e
=
(
p
.
stdin
,
p
.
stdout
,
p
.
stderr
)
if
input
:
if
input
:
i
.
write
(
input
.
encode
())
i
.
write
(
input
.
encode
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment