Skip to content

Commit 7ac51c6

Browse files
committed
Added fix to read file with whitespaces in paths
Fixes: - Fix pipelines with odoo13 to use pip<23 - Fixed platform.processor returning an empty string to fallback to platform.machine - Switched the odoo version to be tested on to 20230601
1 parent 7b6b05e commit 7ac51c6

File tree

7 files changed

+36
-8
lines changed

7 files changed

+36
-8
lines changed

.github/workflows/python-package.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,18 @@ jobs:
6060
sudo apt-get install -y --no-install-recommends postgresql-client git curl build-essential libxml2-dev libsasl2-dev libsass-dev libldap2-dev libjpeg-dev
6161
# python3-lxml python3-pip python3-psycopg2 python3-ldap python3-libsass python3-lxml python3-pillow python3-pypdf2 python3-psutil python3-asn1crypto
6262
63-
- name: Install Test Dependencies
63+
- name: Prepare Pip
64+
run: |
65+
python -m pip install --upgrade "pip<23"
66+
if: ${{ matrix.odoo-version == '13' }}
67+
68+
- name: Prepare Pip
6469
run: |
6570
python -m pip install --upgrade pip
71+
if: ${{ matrix.odoo-version != '13' }}
72+
73+
- name: Install Test Dependencies
74+
run: |
6675
python -m pip install flake8 pytest codecov
6776
python -m pip install -e ".[test]"
6877
python -m pip install "python-ldap>=3.2" "libsass<=0.21,>=0.18" "lxml>=4.5.0" "Pillow>=7.0" "PyPDF2>=1.26" "psutil>=5.5.1"

odoo_tools/api/environment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ def addons_paths(self):
247247
paths = config.get('options', 'addons_path')
248248

249249
config_paths = set(
250-
Path(path)
250+
Path(path.strip())
251251
for path in paths.split(',')
252-
if path
252+
if path.strip()
253253
)
254254

255255
if len(config_paths) > 0 and not self.context.force_addons_lookup:

odoo_tools/cli/click/platform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def platform(ctx):
1313
@platform.command()
1414
@click.pass_context
1515
def arch(ctx):
16-
arch = pp.processor()
16+
arch = pp.processor() or pp.machine()
1717

1818
if arch == "x86_64":
1919
docker_arch = "amd64"

odoo_tools/configuration/odoo.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,16 @@ def install(self):
139139
self.parsed_version.major < 14
140140
):
141141
new_args = args[:]
142+
142143
new_args += [
143-
"setuptools<58"
144+
"setuptools >49, <=58",
145+
"pip <23"
144146
]
145-
146147
run(new_args)
147148

149+
print("Installing vatnumber alone!?")
150+
run(args[:] + ["vatnumber==1.2"])
151+
148152
args += ['.', '-r', str(self.requirement_file)]
149153

150154
with cd(self.odoo_dir):

odoo_tools/requirements/requirements-13.0.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
setuptools<58
1+
setuptools<=58
22
Babel==2.6.0
33
chardet==3.0.4
44
decorator==4.3.0

tests/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def odoo_release():
9292

9393
odoo_version = "{}.0".format(os.environ['TEST_ODOO'])
9494

95-
release = "20230222"
95+
release = "20230601"
9696

9797
env.manage.install_odoo(odoo_version, release=release, opts=options)
9898

tests/test_env.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,21 @@ def test_env_config_addons_path(tmp_path):
8787
assert env.addons_paths() == set()
8888

8989

90+
def test_env_config_whitespace_addons_path(tmp_path):
91+
env = Environment()
92+
93+
env.context.odoo_rc = tmp_path / 'odoo.cfg'
94+
95+
with env.config():
96+
env.set_config('addons_path', ",".join([f" {tmp_path}", ""]))
97+
98+
paths = env.addons_paths()
99+
assert paths == {tmp_path}
100+
101+
env.context.force_addons_lookup = True
102+
assert env.addons_paths() == set()
103+
104+
90105
def test_invalid_env(tmp_path):
91106
env = Environment()
92107

0 commit comments

Comments
 (0)