Skip to content

Commit a0bd5ec

Browse files
committed
Merge PR #71 into master
Signed-off-by legalsylvain
2 parents 1691779 + befa891 commit a0bd5ec

25 files changed

+468
-348
lines changed

.github/workflows/pre-commit.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "*"
7+
push:
8+
branches:
9+
- "master"
10+
11+
jobs:
12+
pre-commit:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-python@v2
17+
with:
18+
python-version: "3.8"
19+
- name: Get python version
20+
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
21+
- uses: actions/cache@v1
22+
with:
23+
path: ~/.cache/pre-commit
24+
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
25+
- name: Install pre-commit
26+
run: pip install pre-commit
27+
- name: Run pre-commit
28+
run: pre-commit run --all-files --show-diff-on-failure --color=always
29+
- name: Check that all files generated by pre-commit are in git
30+
run: |
31+
newfiles="$(git ls-files --others --exclude-from=.gitignore)"
32+
if [ "$newfiles" != "" ] ; then
33+
echo "Please check-in the following files:"
34+
echo "$newfiles"
35+
exit 1
36+
fi

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
exclude: |
2+
(?x)
3+
tests/data_template/|
4+
tests/data_result/
5+
6+
repos:
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v2.3.0
9+
hooks:
10+
- id: check-yaml
11+
- id: end-of-file-fixer
12+
- id: trailing-whitespace
13+
- repo: https://github.com/psf/black
14+
rev: 22.10.0
15+
hooks:
16+
- id: black

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ install:
1919
# command to run tests
2020
script:
2121
- git --version
22-
- flake8 . --exclude=__init__.py,tests/data_*
2322
- coverage run --source odoo_module_migrate setup.py test
2423

2524
after_success:

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
include requirements.txt
2-
recursive-include odoo_module_migrate/migration_scripts/ *.py *.yaml
2+
recursive-include odoo_module_migrate/migration_scripts/ *.py *.yaml

README.rst

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@
33
:alt: License: AGPL-3
44
.. image:: https://img.shields.io/badge/python-3.6-blue.svg
55
:alt: Python support: 3.6
6-
.. image:: https://travis-ci.org/grap/odoo-module-migrator.svg?branch=master
7-
:target: https://travis-ci.org/grap/odoo-module-migrator
8-
.. image:: https://coveralls.io/repos/grap/odoo-module-migrator/badge.png?branch=master
9-
:target: https://coveralls.io/r/grap/odoo-module-migrator?branch=master
6+
.. image:: https://app.travis-ci.com/OCA/odoo-module-migrator.svg?branch=master
7+
:target: https://app.travis-ci.com/OCA/odoo-module-migrator
108

119
====================
1210
odoo-module-migrator
1311
====================
1412

15-
``odoo-module-migrator`` is a python3 library that allows you to automatically migrate
13+
``odoo-module-migrator`` is a python3 library that allows you to automatically migrate
1614
module code to make it compatible with newer Odoo version.
17-
for exemple:
15+
for exemple:
1816

1917
* renaming ``__openerp__.py`` file into ``__manifest__.py``
2018
* removing ``# -*- encoding: utf-8 -*-`` since V11.0
@@ -243,4 +241,3 @@ Contributors
243241
------------
244242

245243
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)
246-

odoo_module_migrate/__main__.py

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313

1414
def get_parser():
1515

16-
main_parser = argparse.ArgumentParser(
17-
formatter_class=argparse.RawTextHelpFormatter
18-
)
16+
main_parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
1917

2018
main_parser.add_argument(
2119
"-d",
@@ -62,16 +60,16 @@ def get_parser():
6260
main_parser.add_argument(
6361
"-fp",
6462
"--format-patch",
65-
action='store_true',
63+
action="store_true",
6664
help="Enable this option, if you want to get the code from the"
67-
" previous branch."
65+
" previous branch.",
6866
)
6967

7068
main_parser.add_argument(
7169
"-rn",
7270
"--remote-name",
7371
dest="remote_name",
74-
default='origin',
72+
default="origin",
7573
type=str,
7674
)
7775

@@ -95,22 +93,27 @@ def get_parser():
9593
main_parser.add_argument(
9694
"-nc",
9795
"--no-commit",
98-
action='store_true',
96+
action="store_true",
9997
default=False,
10098
help="Enable this option, if you don't want that the library commits"
101-
" the changes. (using git add and git commit command)"
99+
" the changes. (using git add and git commit command)",
102100
)
103101

104102
# TODO: Move to `argparse.BooleanOptionalAction` once in Python 3.9+
105103
main_parser.add_argument(
106-
"-npc", "--no-pre-commit", dest="pre_commit", action="store_false",
104+
"-npc",
105+
"--no-pre-commit",
106+
dest="pre_commit",
107+
action="store_false",
107108
help="Skip pre-commit execution",
108109
)
109110

110111
# TODO: Move to `argparse.BooleanOptionalAction` once in Python 3.9+
111112
main_parser.add_argument(
112-
"-nrmf", "--no-remove-migration-folder",
113-
dest="remove_migration_folder", action="store_false",
113+
"-nrmf",
114+
"--no-remove-migration-folder",
115+
dest="remove_migration_folder",
116+
action="store_false",
114117
help="Skip removing migration folder",
115118
)
116119

@@ -131,13 +134,22 @@ def main(args=False):
131134

132135
try:
133136
# Create a new Migration Object
134-
module_names = args.modules\
135-
and [x.strip() for x in args.modules.split(",") if x.strip()] or []
137+
module_names = (
138+
args.modules
139+
and [x.strip() for x in args.modules.split(",") if x.strip()]
140+
or []
141+
)
136142

137143
migration = Migration(
138-
args.directory, args.init_version_name, args.target_version_name,
139-
module_names, args.format_patch, args.remote_name,
140-
not args.no_commit, args.pre_commit, args.remove_migration_folder,
144+
args.directory,
145+
args.init_version_name,
146+
args.target_version_name,
147+
module_names,
148+
args.format_patch,
149+
args.remote_name,
150+
not args.no_commit,
151+
args.pre_commit,
152+
args.remove_migration_folder,
141153
)
142154

143155
# run Migration

0 commit comments

Comments
 (0)