Skip to content
Snippets Groups Projects
Commit 5b074ed49191 authored by Houzefa Abbasbhay's avatar Houzefa Abbasbhay :slight_smile:
Browse files

Fixes to build docs with Python 3

parent 6ca3bf1d203c
No related branches found
No related tags found
No related merge requests found
......@@ -3,10 +3,9 @@
"""Generate a reST file from configuration files
"""
import argparse
import ConfigParser
import logging
import os
import subprocess
import sys
import yaml
......@@ -7,9 +6,10 @@
import logging
import os
import subprocess
import sys
import yaml
from six.moves import configparser
_logger = logging.getLogger(__name__)
......@@ -88,7 +88,7 @@
"""
# read setup.cfg
parser = ConfigParser.ConfigParser()
parser = configparser.ConfigParser()
setup_path = os.path.join(directory, 'setup.cfg')
parser.read(setup_path)
addon_dirs = set(
......@@ -98,7 +98,11 @@
# pip freeze
reqs = dict()
for element in subprocess.check_output(['pip', 'freeze']).split():
library, version = element.split('==')
lib_and_version = element.decode('utf-8').split('==')
if len(lib_and_version) == 1: # No explicit version (no ==).
library, version = lib_and_version[0], "N/A"
else:
library, version = lib_and_version
reqs[library] = {'version': version}
rst = {
......@@ -110,7 +114,7 @@
hgconf_path = os.path.join(directory, '.hgconf')
if os.path.exists(hgconf_path):
_logger.debug("Found .hgconf at %s", hgconf_path)
parser = ConfigParser.ConfigParser()
parser = configparser.ConfigParser()
parser.read(hgconf_path)
for section in parser.sections():
layout = parser.get(section, 'layout')
......@@ -155,7 +159,7 @@
# output the rst
if output:
with open(output, 'wb') as output_file:
with open(output, 'w') as output_file:
write_rst(output_file, rst)
else:
write_rst(sys.stdout, rst)
......
......@@ -58,7 +58,7 @@
fi
done
odoo_modules="$($python -B -c "import ConfigParser ; import os ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print(' '.join(c.get('odoo_scripts', 'modules', '').split()))")"
odoo_modules="$($python -B -c "from six.moves import configparser ; import os ; c = configparser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print(' '.join(c.get('odoo_scripts', 'modules').split()))")"
for module_path in $(eval echo $odoo_modules) ;
do
if [[ -d "$module_path" ]] ; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment