Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with whitespaces in config files paths #27

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,18 @@ jobs:
sudo apt-get install -y --no-install-recommends postgresql-client git curl build-essential libxml2-dev libsasl2-dev libsass-dev libldap2-dev libjpeg-dev
# python3-lxml python3-pip python3-psycopg2 python3-ldap python3-libsass python3-lxml python3-pillow python3-pypdf2 python3-psutil python3-asn1crypto

- name: Install Test Dependencies
- name: Prepare Pip
run: |
python -m pip install --upgrade "pip<23"
if: ${{ matrix.odoo-version == '13' }}

- name: Prepare Pip
run: |
python -m pip install --upgrade pip
if: ${{ matrix.odoo-version != '13' }}

- name: Install Test Dependencies
run: |
python -m pip install flake8 pytest codecov
python -m pip install -e ".[test]"
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"
Expand Down
4 changes: 2 additions & 2 deletions odoo_tools/api/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ def addons_paths(self):
paths = config.get('options', 'addons_path')

config_paths = set(
Path(path)
Path(path.strip())
for path in paths.split(',')
if path
if path.strip()
)

if len(config_paths) > 0 and not self.context.force_addons_lookup:
Expand Down
2 changes: 1 addition & 1 deletion odoo_tools/cli/click/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def platform(ctx):
@platform.command()
@click.pass_context
def arch(ctx):
arch = pp.processor()
arch = pp.processor() or pp.machine()

if arch == "x86_64":
docker_arch = "amd64"
Expand Down
8 changes: 6 additions & 2 deletions odoo_tools/configuration/odoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,16 @@ def install(self):
self.parsed_version.major < 14
):
new_args = args[:]

new_args += [
"setuptools<58"
"setuptools >49, <=58",
"pip <23"
]

run(new_args)

print("Installing vatnumber alone!?")
run(args[:] + ["vatnumber==1.2"])

args += ['.', '-r', str(self.requirement_file)]

with cd(self.odoo_dir):
Expand Down
2 changes: 1 addition & 1 deletion odoo_tools/requirements/requirements-13.0.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
setuptools<58
setuptools<=58
Babel==2.6.0
chardet==3.0.4
decorator==4.3.0
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def odoo_release():

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

release = "20230222"
release = "20230601"

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

Expand Down
15 changes: 15 additions & 0 deletions tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,21 @@ def test_env_config_addons_path(tmp_path):
assert env.addons_paths() == set()


def test_env_config_whitespace_addons_path(tmp_path):
env = Environment()

env.context.odoo_rc = tmp_path / 'odoo.cfg'

with env.config():
env.set_config('addons_path', ",".join([f" {tmp_path}", ""]))

paths = env.addons_paths()
assert paths == {tmp_path}

env.context.force_addons_lookup = True
assert env.addons_paths() == set()


def test_invalid_env(tmp_path):
env = Environment()

Expand Down