Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Odoo scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo scripts
Commits
9d4ed62e0c33
Commit
9d4ed62e0c33
authored
5 years ago
by
Vincent Hatakeyama
Browse files
Options
Downloads
Patches
Plain Diff
add conf2reST to the module
also changed it to be python3 compatible only
parent
f9ef146c2ba4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
odoo_scripts/conf2reST.py
+8
-25
8 additions, 25 deletions
odoo_scripts/conf2reST.py
odoo_scripts/logging.py
+6
-0
6 additions, 0 deletions
odoo_scripts/logging.py
odoo_scripts/odoo.py
+3
-3
3 additions, 3 deletions
odoo_scripts/odoo.py
setup.py
+1
-0
1 addition, 0 deletions
setup.py
with
18 additions
and
28 deletions
conf2reST.py
→
odoo_scripts/
conf2reST.py
+
8
−
25
View file @
9d4ed62e
#!/usr/bin/env python3
#!/usr/bin/env python3
"""
Generate a reST file from configuration files.
"""
Generate a reST file from configuration files.
This script can be used with python 2 or 3, and uses the six library for
compatibility.
"""
"""
import
argparse
import
argparse
import
configparser
import
configparser
...
@@ -12,6 +10,8 @@
...
@@ -12,6 +10,8 @@
import
yaml
import
yaml
from
.logging
import
add_verbosity_to_parser
,
logging_from_verbose
_logger
=
logging
.
getLogger
(
__name__
)
_logger
=
logging
.
getLogger
(
__name__
)
__version__
=
'
1.0.1
'
__version__
=
'
1.0.1
'
...
@@ -54,9 +54,7 @@
...
@@ -54,9 +54,7 @@
parser
.
add_argument
(
parser
.
add_argument
(
'
-V
'
,
'
--version
'
,
action
=
'
version
'
,
'
-V
'
,
'
--version
'
,
action
=
'
version
'
,
version
=
program_version_message
)
version
=
program_version_message
)
parser
.
add_argument
(
add_verbosity_to_parser
(
parser
)
'
-v
'
,
'
--verbose
'
,
dest
=
'
verbose
'
,
action
=
'
count
'
,
help
=
"
set verbosity level [default: %(default)s]
"
)
parser
.
add_argument
(
parser
.
add_argument
(
'
-d
'
,
'
-d
'
,
'
--directory
'
,
'
--directory
'
,
...
@@ -70,14 +68,7 @@
...
@@ -70,14 +68,7 @@
)
)
nmspc
=
parser
.
parse_args
()
nmspc
=
parser
.
parse_args
()
verbose
=
nmspc
.
verbose
logging_from_verbose
(
nmspc
)
if
not
verbose
:
conf2rst
(
nmspc
.
directory
,
nmspc
.
output
)
logging
.
basicConfig
(
level
=
logging
.
WARN
)
if
verbose
==
1
:
logging
.
basicConfig
(
level
=
logging
.
INFO
)
if
verbose
and
verbose
>
1
:
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
basedir
=
os
.
path
.
dirname
(
sys
.
argv
[
0
])
conf2rst
(
basedir
,
nmspc
.
directory
,
nmspc
.
output
)
...
@@ -82,4 +73,4 @@
...
@@ -82,4 +73,4 @@
def
conf2rst
(
basedir
,
directory
,
output
=
None
):
def
conf2rst
(
directory
:
str
,
output
=
None
):
"""
"""
...
@@ -85,5 +76,4 @@
...
@@ -85,5 +76,4 @@
"""
"""
:param basedir: directory with the odoo_versions.csv file
:param directory: destination directory
:param directory: destination directory
:param output: file to write to, else prints in stdout
:param output: file to write to, else prints in stdout
"""
"""
...
@@ -96,5 +86,5 @@
...
@@ -96,5 +86,5 @@
os
.
path
.
dirname
(
path
)
os
.
path
.
dirname
(
path
)
for
path
in
parser
.
get
(
'
odoo_scripts
'
,
'
modules
'
).
split
())
for
path
in
parser
.
get
(
'
odoo_scripts
'
,
'
modules
'
).
split
())
# pip freeze
# pip
3
freeze
reqs
=
dict
()
reqs
=
dict
()
...
@@ -100,12 +90,5 @@
...
@@ -100,12 +90,5 @@
reqs
=
dict
()
reqs
=
dict
()
try
:
pip_freeze
=
subprocess
.
check_output
([
'
pip3
'
,
'
freeze
'
])
pip_freeze
=
subprocess
.
check_output
([
'
pip
'
,
'
freeze
'
])
except
OSError
as
e
:
if
e
.
errno
==
os
.
errno
.
ENOENT
:
pip_freeze
=
subprocess
.
check_output
([
'
pip3
'
,
'
freeze
'
])
else
:
# Something else went wrong
raise
for
element
in
pip_freeze
.
split
():
for
element
in
pip_freeze
.
split
():
lib_and_version
=
element
.
decode
(
'
utf-8
'
).
split
(
'
==
'
)
lib_and_version
=
element
.
decode
(
'
utf-8
'
).
split
(
'
==
'
)
if
len
(
lib_and_version
)
==
1
:
# No explicit version (no ==).
if
len
(
lib_and_version
)
==
1
:
# No explicit version (no ==).
...
...
This diff is collapsed.
Click to expand it.
odoo_scripts/logging.py
+
6
−
0
View file @
9d4ed62e
...
@@ -2,6 +2,12 @@
...
@@ -2,6 +2,12 @@
import
logging
import
logging
def
add_verbosity_to_parser
(
parser
:
argparse
.
ArgumentParser
):
parser
.
add_argument
(
'
-v
'
,
'
--verbose
'
,
dest
=
'
verbose
'
,
action
=
'
count
'
,
help
=
"
set verbosity level [default: %(default)s]
"
)
def
logging_from_verbose
(
namespace
:
argparse
.
Namespace
):
def
logging_from_verbose
(
namespace
:
argparse
.
Namespace
):
verbose
=
namespace
.
verbose
verbose
=
namespace
.
verbose
if
not
verbose
:
if
not
verbose
:
...
...
This diff is collapsed.
Click to expand it.
odoo_scripts/odoo.py
+
3
−
3
View file @
9d4ed62e
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
import
odoorpc
import
odoorpc
from
.logging
import
add_verbosity_to_parser
_logger
=
logging
.
getLogger
(
__name__
)
_logger
=
logging
.
getLogger
(
__name__
)
...
@@ -46,9 +48,7 @@
...
@@ -46,9 +48,7 @@
parser
.
add_argument
(
parser
.
add_argument
(
'
-V
'
,
'
--version
'
,
action
=
'
version
'
,
'
-V
'
,
'
--version
'
,
action
=
'
version
'
,
version
=
version
)
version
=
version
)
parser
.
add_argument
(
add_verbosity_to_parser
(
parser
)
'
-v
'
,
'
--verbose
'
,
dest
=
'
verbose
'
,
action
=
'
count
'
,
help
=
"
set verbosity level [default: %(default)s]
"
)
parser
.
add_argument
(
parser
.
add_argument
(
'
--login
'
,
'
--login
'
,
help
=
"
Odoo user [default: %(default)s]
"
,
help
=
"
Odoo user [default: %(default)s]
"
,
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
0
View file @
9d4ed62e
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
"
docker_dev_start=odoo_scripts.docker_dev_start:main
"
,
"
docker_dev_start=odoo_scripts.docker_dev_start:main
"
,
"
do_tests=odoo_scripts.do_tests:main
"
,
"
do_tests=odoo_scripts.do_tests:main
"
,
"
docker_build=odoo_scripts.docker_build:main
"
,
"
docker_build=odoo_scripts.docker_build:main
"
,
"
conf2reST=odoo_scripts.conf2reST:main
"
,
# TODO add all the other python scripts
# TODO add all the other python scripts
]
]
},
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment