Update setup freeze to Python3

- Use python3 shebang
- Open gir with utf-8 encoding
- Replace user module by executing ~/.pythonrc.py

issue7488
This commit is contained in:
Cédric Krier committed 2018-06-28 02:01:56 +02:00
1 parent 0577ae1652
commit b2cc17d5e7
3 files changed
+23 -10

No files matched your search

+3 -3
View File
@@ -1,8 +1,8 @@
#!/bin/sh
set -e
version=`python setup.py --version`
python setup.py compile_catalog
python setup-freeze.py bdist_mac
version=`./setup.py --version`
./setup.py compile_catalog
./setup-freeze.py bdist_mac
rm -rf dist
mkdir dist
mv build/Tryton.app dist/
+3 -3
View File
@@ -1,7 +1,7 @@
#!/bin/sh
set -e
version=`python setup.py --version`
version=`./setup.py --version`
series=${version%.*}
python setup.py compile_catalog
python setup-freeze.py install_exe -d dist
./setup.py compile_catalog
./setup-freeze.py install_exe -d dist
makensis -DVERSION=${version} -DSERIES=${series} setup.nsi
+17 -4
View File
@@ -1,12 +1,24 @@
#!/usr/bin/env python3
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import os
import re
import sys
import tempfile
import user
from subprocess import Popen, PIPE, check_call
from cx_Freeze import setup, Executable
home = os.path.expanduser('~/')
pythonrc = os.path.join(home, '.pythonrc.py')
try:
with open(pythonrc) as fp:
exec(fp.read())
except IOError:
pass
include_files = [
(os.path.join('tryton', 'data'), 'data'),
(os.path.join('tryton', 'plugins'), 'plugins'),
@@ -60,9 +72,10 @@ for ns in required_gi_namespaces:
gir_name = '%s.gir' % ns
gir_file = os.path.join(sys.prefix, 'share', 'gir-1.0', gir_name)
gir_tmp = os.path.join(temp, gir_name)
with open(gir_file, 'r') as src, open(gir_tmp, 'w') as dst:
for line in src:
dst.write(lib_re.sub(replace_path, line))
with open(gir_file, 'r', encoding='utf-8') as src:
with open(gir_tmp, 'w', encoding='utf-8') as dst:
for line in src:
dst.write(lib_re.sub(replace_path, line))
typefile_name = '%s.typelib' % ns
typefile_file = os.path.join('lib', 'girepository-1.0', typefile_name)
typefile_tmp = os.path.join(temp, typefile_name)