Commit 8971348d authored by Bryton Lacquement's avatar Bryton Lacquement 🚪 Committed by Julien Muchembled

More Py3 fixes

parent 9ca803bb
...@@ -326,7 +326,7 @@ Check option "promises" ...@@ -326,7 +326,7 @@ Check option "promises"
This will download, extract and build our demo package with the This will download, extract and build our demo package with the
default build options. default build options.
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing packagex. Installing packagex.
configure --prefix=/sample_buildout/parts/packagex configure --prefix=/sample_buildout/parts/packagex
...@@ -620,7 +620,7 @@ Let's create a buildout to use these options. ...@@ -620,7 +620,7 @@ Let's create a buildout to use these options.
This will run pre-configure, pre-build, pre-install, post-install as This will run pre-configure, pre-build, pre-install, post-install as
shell command in the corresponding stage. shell command in the corresponding stage.
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: Executing pre-configure package: Executing pre-configure
...@@ -660,7 +660,7 @@ The recipe can specify build options for each platform. For example, ...@@ -660,7 +660,7 @@ The recipe can specify build options for each platform. For example,
In the linux, the recipe gets the options from part 'package', there In the linux, the recipe gets the options from part 'package', there
are only ``pre-configure`` and ``post-install``. the output will be are only ``pre-configure`` and ``post-install``. the output will be
#>>> print system(buildout) #>>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: Executing pre-configure package: Executing pre-configure
...@@ -703,7 +703,7 @@ Let's see what happens when set prefix in the buildout section: ...@@ -703,7 +703,7 @@ Let's see what happens when set prefix in the buildout section:
... pre-configure = mkdir -p "${buildout:prefix}" ... pre-configure = mkdir -p "${buildout:prefix}"
... """ % src) ... """ % src)
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: Executing pre-configure package: Executing pre-configure
...@@ -733,7 +733,7 @@ example, ...@@ -733,7 +733,7 @@ example,
... post-install = test -d "${buildout:prefix}" || echo "None" ... post-install = test -d "${buildout:prefix}" || echo "None"
... """ % src) ... """ % src)
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: Executing pre-configure package: Executing pre-configure
...@@ -766,7 +766,7 @@ prefix: ...@@ -766,7 +766,7 @@ prefix:
... pre-install = sleep 2; mkdir -p "${buildout:prefix}" ; echo x >"${buildout:prefix}/b.txt"; echo ... pre-install = sleep 2; mkdir -p "${buildout:prefix}" ; echo x >"${buildout:prefix}/b.txt"; echo
... """ % (src, src)) ... """ % (src, src))
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing package. Installing package.
configure --prefix=/sample_buildout/mylocal configure --prefix=/sample_buildout/mylocal
...@@ -801,7 +801,7 @@ as nothing it is removing): ...@@ -801,7 +801,7 @@ as nothing it is removing):
... pre-install = sleep 2; mkdir -p "${buildout:prefix}" ; echo x >"${buildout:prefix}/a.txt" ... pre-install = sleep 2; mkdir -p "${buildout:prefix}" ; echo x >"${buildout:prefix}/a.txt"
... """ % src) ... """ % src)
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package-2. Uninstalling package-2.
Updating package. Updating package.
...@@ -854,7 +854,7 @@ value in the part section. For example, ...@@ -854,7 +854,7 @@ value in the part section. For example,
... post-install = echo package magic prefix is ${package:prefix} ... post-install = echo package magic prefix is ${package:prefix}
... """ % (src, src)) ... """ % (src, src))
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing package. Installing package.
Installing package-2. Installing package-2.
...@@ -878,7 +878,7 @@ can display "prefix" value in the stdout. ...@@ -878,7 +878,7 @@ can display "prefix" value in the stdout.
... pre-install = sed -i -e "s/installing package/installing package at \$\$prefix /g" Makefile ... pre-install = sed -i -e "s/installing package/installing package at \$\$prefix /g" Makefile
... """ % src) ... """ % src)
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package-2. Uninstalling package-2.
Uninstalling package. Uninstalling package.
Installing package. Installing package.
...@@ -904,7 +904,7 @@ replaced with the recipe final prefix. ...@@ -904,7 +904,7 @@ replaced with the recipe final prefix.
... pre-install = sed -i -e "s/installing package/installing package at \$\$prefix /g" Makefile ... pre-install = sed -i -e "s/installing package/installing package at \$\$prefix /g" Makefile
... """ % src) ... """ % src)
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing package. Installing package.
configure configure
...@@ -938,7 +938,7 @@ dependent parts before install this part. For example, ...@@ -938,7 +938,7 @@ dependent parts before install this part. For example,
Here "package-2" will be installed first, because it's a denpend part Here "package-2" will be installed first, because it's a denpend part
of "package": of "package":
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing package-2. Installing package-2.
configure --prefix=/sample_buildout/parts/package-2 configure --prefix=/sample_buildout/parts/package-2
...@@ -970,7 +970,7 @@ Now let's add a new option for "package-2", ...@@ -970,7 +970,7 @@ Now let's add a new option for "package-2",
Look, "package" is reinstalled either: Look, "package" is reinstalled either:
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Uninstalling package-2. Uninstalling package-2.
Installing package-2. Installing package-2.
...@@ -1005,7 +1005,7 @@ If no shared-parts is set, and shared is True, shared feature is not used: ...@@ -1005,7 +1005,7 @@ If no shared-parts is set, and shared is True, shared feature is not used:
... shared = True ... shared = True
... """% src) ... """% src)
>>> print system(buildout) #doctest:+ELLIPSIS >>> print(system(buildout)) #doctest:+ELLIPSIS
Uninstalling package. Uninstalling package.
Uninstalling package-2. Uninstalling package-2.
Installing package. Installing package.
...@@ -1023,7 +1023,7 @@ process as the recipe tried. ...@@ -1023,7 +1023,7 @@ process as the recipe tried.
>>> import sys >>> import sys
>>> tarpath = os.path.join(src, 'package-0.0.0.tar.gz') >>> tarpath = os.path.join(src, 'package-0.0.0.tar.gz')
>>> with tarfile.open(tarpath, 'w:gz') as tar: >>> with tarfile.open(tarpath, 'w:gz') as tar:
... configure = 'invalid' ... configure = b'invalid'
... info = tarfile.TarInfo('configure.off') ... info = tarfile.TarInfo('configure.off')
... info.size = len(configure) ... info.size = len(configure)
... info.mode = 0o755 ... info.mode = 0o755
...@@ -1042,7 +1042,7 @@ process as the recipe tried. ...@@ -1042,7 +1042,7 @@ process as the recipe tried.
... environment = ... environment =
... FOO=bar ... FOO=bar
... """ % (shared_dir, src)) ... """ % (shared_dir, src))
>>> print system(buildout) #doctest:+ELLIPSIS >>> print(system(buildout)) #doctest:+ELLIPSIS
package: shared directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/... set for package package: shared directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/... set for package
Uninstalling package. Uninstalling package.
Installing package. Installing package.
...@@ -1062,7 +1062,7 @@ process as the recipe tried. ...@@ -1062,7 +1062,7 @@ process as the recipe tried.
If shared-parts is set and shared is True, package will be installed in shared_part/package/a hash of the recipe's configuration options If shared-parts is set and shared is True, package will be installed in shared_part/package/a hash of the recipe's configuration options
>>> _ = system('mv %s/package-0.0.0.tar.gz.bak %s/package-0.0.0.tar.gz' % (src, src)) >>> _ = system('mv %s/package-0.0.0.tar.gz.bak %s/package-0.0.0.tar.gz' % (src, src))
>>> print system(buildout) #doctest:+ELLIPSIS >>> print(system(buildout)) #doctest:+ELLIPSIS
package: shared directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/... set for package package: shared directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/... set for package
Installing package. Installing package.
package: Checking whether package is installed at shared path: .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/... package: Checking whether package is installed at shared path: .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/...
...@@ -1087,7 +1087,7 @@ Do nothing if one package has been installed. ...@@ -1087,7 +1087,7 @@ Do nothing if one package has been installed.
... environment = ... environment =
... FOO=bar ... FOO=bar
... """ % (shared_dir, src)) ... """ % (shared_dir, src))
>>> print system(buildout) #doctest:+ELLIPSIS >>> print(system(buildout)) #doctest:+ELLIPSIS
package: shared directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/... set for package package: shared directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/... set for package
Installing package. Installing package.
package: Checking whether package is installed at shared path: .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/... package: Checking whether package is installed at shared path: .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/...
...@@ -1108,7 +1108,7 @@ If options change, reinstall in different location: ...@@ -1108,7 +1108,7 @@ If options change, reinstall in different location:
... change = True ... change = True
... """ % (shared_dir, src)) ... """ % (shared_dir, src))
>>> print system(buildout) #doctest:+ELLIPSIS >>> print(system(buildout)) #doctest:+ELLIPSIS
package: shared directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/... set for package package: shared directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/... set for package
Uninstalling package. Uninstalling package.
Installing package. Installing package.
......
...@@ -95,7 +95,7 @@ class Recipe(object): ...@@ -95,7 +95,7 @@ class Recipe(object):
for part in options.get('dependencies', '').split(): for part in options.get('dependencies', '').split():
m = md5() m = md5()
for v in self.buildout[part].values(): for v in self.buildout[part].values():
m.update(v) m.update(v.encode('utf-8'))
dependencies.append(m.hexdigest()) dependencies.append(m.hexdigest())
options['dependencies'] = ' '.join(dependencies) options['dependencies'] = ' '.join(dependencies)
...@@ -109,8 +109,7 @@ class Recipe(object): ...@@ -109,8 +109,7 @@ class Recipe(object):
else: else:
options['compile-directory'] = options['path'] options['compile-directory'] = options['path']
from copy import copy for k, v in list(options.items()):
for k, v in copy(options.items()):
if '@@LOCATION@@' in v: if '@@LOCATION@@' in v:
options[k] = v.replace('@@LOCATION@@', default_location) options[k] = v.replace('@@LOCATION@@', default_location)
...@@ -214,7 +213,7 @@ class Recipe(object): ...@@ -214,7 +213,7 @@ class Recipe(object):
log = logging.getLogger(self.name) log = logging.getLogger(self.name)
args = ['find', self.buildout_prefix, '-cnewer', ref_file, '!', '-type', 'd'] args = ['find', self.buildout_prefix, '-cnewer', ref_file, '!', '-type', 'd']
try: try:
p = subprocess.Popen(args, stdout=subprocess.PIPE) p = subprocess.Popen(args, stdout=subprocess.PIPE, universal_newlines=True)
files, _ = p.communicate() files, _ = p.communicate()
retcode = p.returncode retcode = p.returncode
if retcode < 0: if retcode < 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment