Closed vooon closed 4 years ago
I have been building this project using Python 3, and the only script I needed to change was infi.recipe.python
.
After applying this patch I managed to build successfully:
infi.recipe.python-0.6.23-pack.patch
:
This patch makes it work on Python 3
See changes in the tarfile module:
https://docs.python.org/2/library/tarfile.html#tarfile.TarFile.add
https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.add
diff --git a/pack/__init__.py b/pack/__init__.py
index bbfa6ae..483fb24 100644
--- a/pack/__init__.py
+++ b/pack/__init__.py
@@ -64,7 +64,7 @@ class Recipe(object):
def _write_archive(self):
import tarfile
archive = tarfile.open(name=self.destination_file, mode='w:gz')
- archive.add(name=self.source, arcname='python', exclude=self._tarfile_exclude)
+ archive.add(name=self.source, arcname='python', filter=self._tarfile_filter)
def _build_include_list(self):
self._include_list = [path.strip() for path in self._options.get("include_list", '').splitlines()]
@@ -74,17 +74,18 @@ class Recipe(object):
if '' in self._exclude_list:
self._exclude_list.remove('')
- def _tarfile_exclude(self, path):
+ def _tarfile_filter(self, tarinfo):
+ path = tarinfo.path
if path in self._exclude_list:
- return True
+ return None
if path in self._include_list:
- return False
+ return tarinfo
for basepath in self._include_list:
if path in basepath:
- return False
+ return tarinfo
if basepath in path:
- return False
- return True
+ return tarinfo
+ return None
def update(self):
pass
This issue in particular has been fixed with v0.6.24
: https://github.com/Infinidat/infi.recipe.python/commit/ce9efb4e1d14a6be5f179b20de7354eb2b7ec19a
Seems it works for 3.7 (but there i got some problem with FTP), on develop i have to patch to get it run:
diff --git a/src/scripts/__init__.py b/src/scripts/__init__.py
index 79d971b..9cb55ba 100644
--- a/src/scripts/__init__.py
+++ b/src/scripts/__init__.py
@@ -22,7 +22,7 @@ def execte_buildout(buildout_file, env=None):
import sys
argv = ' '.join(sys.argv[1:])
command = "./bin/buildout -c {0} {1}".format(buildout_file, argv)
- print 'executing "%s"' % command
+ print('executing "%s"' % command)
process = Popen(command.split(), env=env)
stdout, stderr = process.communicate()
sys.exit(process.returncode)
@@ -130,40 +130,40 @@ def clean():
parts = sep.join([base, 'parts'])
installed_file = sep.join([base, '.installed-build.cfg'])
- print "base = %s" % repr(base)
+ print("base = %s" % repr(base))
for tar_gz in glob(sep.join([base, '*tar.gz'])):
- print "rm %s" % tar_gz
+ print("rm %s" % tar_gz)
remove(tar_gz)
- print "rm -rf %s" % repr(dist)
+ print("rm -rf %s" % repr(dist))
_catch_and_print(rmtree, *[dist])
src = sep.join([parts, 'buildout'])
dst = sep.join([base, 'buildout'])
- print "mv %s %s" % (repr(src), repr(dst))
+ print("mv %s %s" % (repr(src), repr(dst)))
_catch_and_print(move, *[src, dst])
- print "rm %s" % repr(installed_file)
+ print("rm %s" % repr(installed_file))
if exists(installed_file):
remove(installed_file)
- print "rm -rf %s" % repr(parts)
+ print("rm -rf %s" % repr(parts))
_catch_and_print(rmtree, *[parts])
- print "mkdir %s" % repr(parts)
+ print("mkdir %s" % repr(parts))
_catch_and_print(mkdir, *[parts])
dst = sep.join([parts, 'buildout'])
src = sep.join([base, 'buildout'])
- print "mv %s %s" % (repr(src), repr(dst))
+ print("mv %s %s" % (repr(src), repr(dst)))
_catch_and_print(move, *[src, dst])
def _catch_and_print(func, *args, **kwargs):
try:
func(*args, **kwargs)
- except (OSError, IOError), e:
- print e
+ except (OSError, IOError) as e:
+ print(e)
Hello,
On Ubuntu 19.04,
pip
is switched to be python 3.7, somake make
installs buildout to use 3.7. But some of your scripts is not compatible wit py3. For example you still useprint "foo"
.