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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
slapos.buildout
Commits
c8f02362
Commit
c8f02362
authored
Jul 03, 2018
by
Reinout van Rees
Committed by
GitHub
Jul 03, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #459 from NextThought/fix-warnings
Fix most Deprecation and Resource warnings.
parents
c6e878af
f1589378
Changes
20
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
147 additions
and
117 deletions
+147
-117
Makefile
Makefile
+1
-1
doc/topics/bootstrapping.rst
doc/topics/bootstrapping.rst
+4
-1
setup.py
setup.py
+2
-1
src/zc/buildout/bootstrap.txt
src/zc/buildout/bootstrap.txt
+8
-6
src/zc/buildout/bootstrap_cl_settings.test
src/zc/buildout/bootstrap_cl_settings.test
+4
-2
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+9
-9
src/zc/buildout/buildout.txt
src/zc/buildout/buildout.txt
+4
-0
src/zc/buildout/configparser.py
src/zc/buildout/configparser.py
+1
-1
src/zc/buildout/configparser.test
src/zc/buildout/configparser.test
+24
-24
src/zc/buildout/download.py
src/zc/buildout/download.py
+1
-8
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+1
-1
src/zc/buildout/repeatable.txt
src/zc/buildout/repeatable.txt
+2
-2
src/zc/buildout/rmtree.py
src/zc/buildout/rmtree.py
+1
-2
src/zc/buildout/testing.py
src/zc/buildout/testing.py
+19
-2
src/zc/buildout/tests.py
src/zc/buildout/tests.py
+52
-44
src/zc/buildout/windows.txt
src/zc/buildout/windows.txt
+1
-1
tox.ini
tox.ini
+1
-1
zc.recipe.egg_/setup.py
zc.recipe.egg_/setup.py
+2
-1
zc.recipe.egg_/src/zc/recipe/egg/egg.py
zc.recipe.egg_/src/zc/recipe/egg/egg.py
+1
-1
zc.recipe.egg_/src/zc/recipe/egg/tests.py
zc.recipe.egg_/src/zc/recipe/egg/tests.py
+9
-9
No files found.
Makefile
View file @
c8f02362
...
...
@@ -51,4 +51,4 @@ clean:
rm
-rf
$(BUILD_DIRS)
$(PYTHON_BUILD_DIR)
test
:
$(HERE)
/bin/test
-1
-vvv
$(HERE)
/bin/test
-1
-vvv
-c
doc/topics/bootstrapping.rst
View file @
c8f02362
...
...
@@ -97,6 +97,8 @@ And then run it:
>>> eqs(os.listdir("."), 'bootstrap-buildout.py',
... 'buildout.cfg', 'eggs', 'bin', 'develop-eggs', 'parts')
>>> os.chdir('..')
>>> p.stdout.close()
>>> p.stderr.close()
It will download the software needed to run Buildout and install it in
the current directory.
...
...
@@ -167,6 +169,8 @@ This can be used with the bootstrapping script as well:
... print(p.stderr.read())
>>> eqs(os.listdir("."), 'bootstrap-buildout.py',
... 'buildout.cfg', 'eggs', 'bin', 'develop-eggs', 'parts')
>>> p.stdout.close()
>>> p.stderr.close()
This creates an empty Buildout configuration:
...
...
@@ -220,4 +224,3 @@ command above would generate a buildout configuration file:
This can provide an easy way to experiment with a package without
adding it to your Python environment or creating a virtualenv.
setup.py
View file @
c8f02362
...
...
@@ -18,7 +18,8 @@ import os
from
setuptools
import
setup
def
read
(
*
rnames
):
return
open
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
*
rnames
)).
read
()
with
open
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
*
rnames
))
as
f
:
return
f
.
read
()
long_description
=
read
(
'README.rst'
)
+
'
\
n
'
+
read
(
'CHANGES.rst'
)
...
...
src/zc/buildout/bootstrap.txt
View file @
c8f02362
...
...
@@ -19,7 +19,9 @@ Make sure the bootstrap script actually works::
... [buildout]
... parts =
... ''')
>>> write('bootstrap.py', open(bootstrap_py).read())
>>> with open(bootstrap_py) as f:
... bootstrap_py_contents = f.read()
>>> write('bootstrap.py', bootstrap_py_contents)
>>> print_('X'); print_(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py')); print_('X') # doctest: +ELLIPSIS
...
...
@@ -52,7 +54,7 @@ By default it gets the latest version::
>>> buildout_script = join(sample_buildout, 'bin', 'buildout')
>>> if sys.platform.startswith('win'):
... buildout_script += '-script.py'
>>>
print_(open(buildout_script)
.read()) # doctest: +ELLIPSIS
>>>
with open(buildout_script) as f: print_(f
.read()) # doctest: +ELLIPSIS
#...
sys.path[0:0] = [
'/sample/eggs/zc.buildout-22.0.0...egg',
...
...
@@ -83,7 +85,7 @@ Now let's try with ``2.0.0``, which happens to exist::
Let's make sure the generated ``buildout`` script uses it::
>>>
print_(open(buildout_script)
.read()) # doctest: +ELLIPSIS
>>>
with open(buildout_script) as f: print_(f
.read()) # doctest: +ELLIPSIS
#...
sys.path[0:0] = [
'/sample/eggs/zc.buildout-2.0.0...egg',
...
...
@@ -103,7 +105,7 @@ Now let's try with ``31.0.0``, which happens to exist::
Let's make sure the generated ``buildout`` script uses it::
>>>
print_(open(buildout_script)
.read()) # doctest: +ELLIPSIS
>>>
with open(buildout_script) as f: print_(f
.read()) # doctest: +ELLIPSIS
#...
sys.path[0:0] = [
'/sample/eggs/zc.buildout-...egg',
...
...
@@ -121,7 +123,7 @@ which happens to exist::
Let's make sure the generated ``buildout`` script uses it::
>>>
print_(open(buildout_script)
.read()) # doctest: +ELLIPSIS
>>>
with open(buildout_script) as f: print_(f
.read()) # doctest: +ELLIPSIS
#...
sys.path[0:0] = [
'/sample/eggs/zc.buildout-2.0.0...egg',
...
...
@@ -153,7 +155,7 @@ specify the setuptools version, and to reuse the setuptools zipfile::
>>> os.path.exists('setuptools-32.1.0.zip')
True
>>>
print_(open(buildout_script)
.read()) # doctest: +ELLIPSIS
>>>
with open(buildout_script) as f: print_(f
.read()) # doctest: +ELLIPSIS
#...
sys.path[0:0] = [
'/sample/eggs/zc.buildout-2.0.0...egg',
...
...
src/zc/buildout/bootstrap_cl_settings.test
View file @
c8f02362
...
...
@@ -20,7 +20,8 @@ Some people pass buildout settings to bootstrap.
... [buildout]
... parts =
... '''
)
>>>
write
(
'bootstrap.py'
,
open
(
bootstrap_py
)
.
read
())
>>>
with
open
(
bootstrap_py
)
as
f
:
bootstrap_py_contents
=
f
.
read
()
>>>
write
(
'bootstrap.py'
,
bootstrap_py_contents
)
>>>
print_
(
'X'
);
print_
(
system
(
...
zc
.
buildout
.
easy_install
.
_safe_arg
(
sys
.
executable
)
+
...
' bootstrap.py buildout:directory='
+
top
+
...
...
@@ -43,7 +44,8 @@ They might do it with init, but no worries:
>>>
os
.
chdir
(
top
)
>>>
mkdir
(
top
,
'buildout'
)
>>>
os
.
chdir
(
top
)
>>>
write
(
'bootstrap.py'
,
open
(
bootstrap_py
)
.
read
())
>>>
with
open
(
bootstrap_py
)
as
f
:
bootstrap_py_contents
=
f
.
read
()
>>>
write
(
'bootstrap.py'
,
bootstrap_py_contents
)
>>>
print_
(
'X'
);
print_
(
system
(
...
zc
.
buildout
.
easy_install
.
_safe_arg
(
sys
.
executable
)
+
...
' bootstrap.py buildout:directory='
+
top
+
...
...
src/zc/buildout/buildout.py
View file @
c8f02362
...
...
@@ -893,7 +893,7 @@ class Buildout(DictMixin):
setup
=
self
.
_buildout_path
(
setup
)
files
=
glob
.
glob
(
setup
)
if
not
files
:
self
.
_logger
.
warn
(
"Couldn't develop %r (not found)"
,
self
.
_logger
.
warn
ing
(
"Couldn't develop %r (not found)"
,
setup
)
else
:
files
.
sort
()
...
...
@@ -1108,7 +1108,7 @@ class Buildout(DictMixin):
if
(
realpath
(
os
.
path
.
abspath
(
sys
.
argv
[
0
]))
!=
should_run
):
self
.
_logger
.
debug
(
"Running %r."
,
realpath
(
sys
.
argv
[
0
]))
self
.
_logger
.
debug
(
"Local buildout is %r."
,
should_run
)
self
.
_logger
.
warn
(
"Not upgrading because not running a local "
self
.
_logger
.
warn
ing
(
"Not upgrading because not running a local "
"buildout command."
)
return
...
...
@@ -1464,7 +1464,7 @@ class Options(DictMixin):
_template_split
=
re
.
compile
(
'([$]{[^}]*})'
).
split
_simple
=
re
.
compile
(
'[-a-zA-Z0-9 ._]+$'
).
match
_valid
=
re
.
compile
(
'
\
${[-
a
-zA-Z0-9 ._]*:[-a-zA-Z0-9 ._]+}$'
).
match
_valid
=
re
.
compile
(
r
'\
${[-
a-zA-Z0-9 ._]*:[-a-zA-Z0-9 ._]+}$'
).
match
def
_sub
(
self
,
template
,
seen
):
value
=
self
.
_template_split
(
template
)
subs
=
[]
...
...
@@ -1563,7 +1563,7 @@ class Options(DictMixin):
elif
os
.
path
.
isfile
(
p
):
os
.
remove
(
p
)
else
:
self
.
buildout
.
_logger
.
warn
(
"Couldn't clean up %r."
,
p
)
self
.
buildout
.
_logger
.
warn
ing
(
"Couldn't clean up %r."
,
p
)
raise
finally
:
self
.
_created
=
None
...
...
@@ -1921,7 +1921,7 @@ def _check_for_unused_options_in_section(buildout, section):
unused
=
[
option
for
option
in
sorted
(
options
.
_raw
)
if
option
not
in
options
.
_data
]
if
unused
:
buildout
.
_logger
.
warn
(
"Unused options for %s: %s."
buildout
.
_logger
.
warn
ing
(
"Unused options for %s: %s."
%
(
section
,
' '
.
join
(
map
(
repr
,
unused
)))
)
...
...
src/zc/buildout/buildout.txt
View file @
c8f02362
...
...
@@ -3355,3 +3355,7 @@ We see that our extension is loaded and executed::
ext ['buildout', 'versions']
Develop: '/sample-bootstrapped/demo'
unload ['buildout', 'versions']
..
>>> stop_server(server_url)
src/zc/buildout/configparser.py
View file @
c8f02362
...
...
@@ -178,7 +178,7 @@ def parse(fp, fpname, exp_globals=dict):
tail = tail.replace(';', '#') if tail else ''
# un-escape literal # and ; . Do not use a
# string-escape decode
expr = expression.replace(r'
\
x23
','#').replace(r'x3b', ';')
expr = expression.replace(r'
\
x23
','#').replace(r'
\
x3b
', ';')
# rebuild a valid Python expression wrapped in a list
expr = head + expr + tail
# lazily populate context only expression
...
...
src/zc/buildout/configparser.test
View file @
c8f02362
src/zc/buildout/download.py
View file @
c8f02362
...
...
@@ -20,15 +20,8 @@ except ImportError:
try
:
# Python 3
from
urllib.request
import
FancyURLopener
,
URLopener
,
urlretrieve
from
urllib.request
import
urlretrieve
from
urllib.parse
import
urlparse
from
urllib
import
request
class
PatchedURLopener
(
FancyURLopener
):
http_error_default
=
URLopener
.
http_error_default
request
.
_urlopener
=
PatchedURLopener
()
# Ook! Monkey patch!
except
ImportError
:
# Python 2
import
base64
...
...
src/zc/buildout/easy_install.py
View file @
c8f02362
...
...
@@ -637,7 +637,7 @@ class Installer(object):
if
dist_needs_pkg_resources
(
dist
):
# We have a namespace package but no requirement for setuptools
if
dist
.
precedence
==
pkg_resources
.
DEVELOP_DIST
:
logger
.
warn
(
logger
.
warn
ing
(
"Develop distribution: %s
\
n
"
"uses namespace packages but the distribution "
"does not require setuptools."
,
...
...
src/zc/buildout/repeatable.txt
View file @
c8f02362
...
...
@@ -397,7 +397,7 @@ at the end.
The versions file now contains the extra pin:
>>>
print_(open('my_versions.cfg')
.read()) # doctest: +ELLIPSIS
>>>
with open('my_versions.cfg') as f: print_(f
.read()) # doctest: +ELLIPSIS
<BLANKLINE>
...
# Added by buildout at YYYY-MM-DD hh:mm:ss.dddddd
...
...
@@ -437,7 +437,7 @@ printing them to the console):
The versions file contains the extra pin:
>>>
print_(open('my_versions.cfg')
.read()) # doctest: +ELLIPSIS
>>>
with open('my_versions.cfg') as f: print_(f
.read()) # doctest: +ELLIPSIS
<BLANKLINE>
[versions]
...
...
...
src/zc/buildout/rmtree.py
View file @
c8f02362
...
...
@@ -40,7 +40,7 @@ def rmtree (path):
Now create a file ...
>>> foo = os.path.join (d, 'foo')
>>>
_ = open (foo, 'w')
.write ('huhu')
>>>
with open (foo, 'w') as f: _ = f
.write ('huhu')
and make it unwriteable
...
...
@@ -75,4 +75,3 @@ def test_suite():
if
"__main__"
==
__name__
:
doctest
.
testmod
()
src/zc/buildout/testing.py
View file @
c8f02362
...
...
@@ -131,6 +131,19 @@ def system(command, input='', with_exit_code=False):
# https://github.com/buildout/buildout/pull/311
# http://bugs.python.org/issue19884
env
=
dict
(
os
.
environ
,
TERM
=
'dumb'
)
# Beginning in Python 3.4, 'U' mode to open() is deprecated.
# Python 3.7 changes the way deprecations are shown for main
# modules, and introduces $PYTHONDEVMODE which turns on warnigs in
# more places. If that's done, this leads many of our doctests to
# break; some code path through executing setup.py does this, but
# it's not in our code. Unfortunately, normalizing this printed
# line away doesn't work, it just produces a blank line. We resort
# to turning that warning off.
warnings
=
env
.
get
(
'PYTHONWARNINGS'
,
''
)
env
[
'PYTHONWARNINGS'
]
=
"ignore:'U' mode is deprecated:DeprecationWarning::,"
+
warnings
p
=
subprocess
.
Popen
(
command
,
shell
=
True
,
stdin
=
subprocess
.
PIPE
,
...
...
@@ -150,6 +163,7 @@ def system(command, input='', with_exit_code=False):
# Use the with_exit_code=True parameter when you want to test the exit
# code of the command you're running.
output
+=
'EXIT CODE: %s'
%
p
.
wait
()
p
.
wait
()
return
output
def
get
(
url
):
...
...
@@ -358,6 +372,7 @@ def buildoutSetUp(test):
sdist
=
sdist
,
bdist_egg
=
bdist_egg
,
start_server
=
start_server
,
stop_server
=
stop_server
,
buildout
=
os
.
path
.
join
(
sample
,
'bin'
,
'buildout'
),
wait_until
=
wait_until
,
print_
=
print_
,
...
...
@@ -395,6 +410,7 @@ class Handler(BaseHTTPRequestHandler):
def
do_GET
(
self
):
if
'__stop__'
in
self
.
path
:
self
.
__server
.
server_close
()
raise
SystemExit
def
k
():
...
...
@@ -466,6 +482,7 @@ def _run(tree, port):
server_address
=
(
'localhost'
,
port
)
httpd
=
Server
(
tree
,
server_address
,
Handler
)
httpd
.
serve_forever
()
httpd
.
server_close
()
def
get_port
():
for
i
in
range
(
10
):
...
...
@@ -578,10 +595,10 @@ if sys.version_info > (2, ):
re
.
compile
(
'(
\
n
?)d __pycache__
\
n
'
),
'
\
\
1'
)
else
:
normalize___pycache__
=
(
re
.
compile
(
'(
\
n
?)-
\
S+
\
.pyc
\
n
'
),
'
\
\
1'
)
re
.
compile
(
r
'(\n?)- \
S+
\.pyc\n'
),
'
\
\
1'
)
normalize_egg_py
=
(
re
.
compile
(
'-py
\
d[.]
\
d(-
\
S+)?.egg
'
),
re
.
compile
(
r
'-py\
d[.]
\d(-\
S+)?.egg
'),
'
-
pyN
.
N
.
egg
',
)
...
...
src/zc/buildout/tests.py
View file @
c8f02362
This diff is collapsed.
Click to expand it.
src/zc/buildout/windows.txt
View file @
c8f02362
...
...
@@ -28,7 +28,7 @@ can't delete.
... os.makedirs (self.location)
...
... name = os.path.join (self.location, 'readonly.txt')
...
open (name, 'w')
.write ('this is a read only file')
...
with open (name, 'w') as f: f
.write ('this is a read only file')
... os.chmod(name, 256)
... return ()
...
...
...
tox.ini
View file @
c8f02362
...
...
@@ -8,7 +8,7 @@ commands =
# buildout's dev.py wants python to not have setuptools
pip
uninstall
-y
zc.buildout
setuptools
pip
python
dev.py
{toxinidir}/bin/test
-1
-v
-c
{toxinidir}/bin/test
-1
-v
vv
-c
coverage
combine
coverage
report
# since we're removing setuptools we can't possibly reuse the virtualenv
...
...
zc.recipe.egg_/setup.py
View file @
c8f02362
...
...
@@ -20,7 +20,8 @@ import os
from
setuptools
import
setup
,
find_packages
def
read
(
*
rnames
):
return
open
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
*
rnames
)).
read
()
with
open
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
*
rnames
))
as
f
:
return
f
.
read
()
name
=
"zc.recipe.egg"
setup
(
...
...
zc.recipe.egg_/src/zc/recipe/egg/egg.py
View file @
c8f02362
...
...
@@ -220,7 +220,7 @@ class Scripts(Eggs):
assert
relative_paths
==
'false'
parse_entry_point
=
re
.
compile
(
'([^=]+)=(
\
w+(?:[.]
\
w+)*):(
\
w+(?:[.]
\
w+)*)$'
r
'([^=]+)=(\
w+(?:[.]
\w+)*):(\
w+(?:[.]
\w+)*)$'
).
match
def
install
(
self
):
...
...
zc.recipe.egg_/src/zc/recipe/egg/tests.py
View file @
c8f02362
...
...
@@ -50,9 +50,9 @@ def test_suite():
zc
.
buildout
.
tests
.
normalize_bang
,
zc
.
buildout
.
tests
.
normalize_S
,
zc
.
buildout
.
testing
.
not_found
,
(
re
.
compile
(
'[d-] zc.buildout(-
\
S+)?[.]egg(-li
n
k)?'
),
(
re
.
compile
(
r
'[d-] zc.buildout(-\
S+)?[.]egg(-li
nk)?'
),
'zc.buildout.egg'
),
(
re
.
compile
(
'[d-] setuptools-[^-]+-'
),
'setuptools-X-'
),
(
re
.
compile
(
r
'[d-] setuptools-[^-]+-'
),
'setuptools-X-'
),
(
re
.
compile
(
r'eggs\\\\demo'
),
'eggs/demo'
),
(
re
.
compile
(
r'[a-zA-Z]:\\\\foo\\\\bar'
),
'/foo/bar'
),
])
...
...
@@ -66,15 +66,15 @@ def test_suite():
zc
.
buildout
.
testing
.
normalize_endings
,
zc
.
buildout
.
testing
.
not_found
,
(
re
.
compile
(
'__buildout_signature__ = '
'sample-
\
S+
\
s+'
'zc.recipe.egg-
\
S+
\
s+'
'setuptools-
\
S+
\
s+'
'zc.buildout-
\
S+
\
s*'
r
'sample-\
S+
\s+'
r
'zc.recipe.egg-\
S+
\s+'
r
'setuptools-\
S+
\s+'
r
'zc.buildout-\
S+
\s*'
),
'__buildout_signature__ = sample- zc.recipe.egg-'
),
(
re
.
compile
(
'find-links = http://localhost:
\
d+/
'
),
(
re
.
compile
(
r
'find-links = http://localhost:\
d+/
'),
'
find
-
links
=
http
:
//
localhost
:
8080
/
'),
(re.compile('
index
=
http
:
//
localhost
:
\
d
+/
index
'),
(re.compile(
r
'
index
=
http
:
//
localhost
:
\
d
+/
index
'),
'
index
=
http
:
//
localhost
:
8080
/
index
'),
])
),
...
...
@@ -87,7 +87,7 @@ def test_suite():
zc.buildout.testing.normalize_endings,
zc.buildout.testing.not_found,
(re.compile("(d ((ext)?demo(needed)?|other)"
"-
\
d[.]
\
d-py)
\
d[.]
\
d(-
\
S+)?[.]egg
"
),
r
"-
\
d[.]
\
d-py)
\
d[.]
\
d(-
\
S+)?[.]egg
"
),
'
\\
1
V
.
V
.
egg
'),
(re.compile('
extdemo
.
c
\
n
.
+
\\\\
extdemo
.
exp
\
n
'), ''),
(re.compile(
...
...
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