Skip to content

requirements.txt lacks of minimum compatible version of lxml dependency #73

Description

@are-agilebg

The requirements.txt does not dictate what version of the listed packages should be installed.

However, looking at lxml specifically, this project relies on lxml.etree providing an indent method, see for example:

This method however has been added to lxml only from version 4.5.0 (see Changelog)

To Reproduce

Latest odoo-module-migrator binary (0.4.0). Install a lxml version prior to 4.5.0 (I was using 4.2.3 but the exact version is not relevant).

While executing a migration:

Traceback (most recent call last):
  File "/home/are/.pyenv/versions/3.7.13/bin/odoo-module-migrate", line 8, in <module>
    sys.exit(main())
  File "/home/are/.pyenv/versions/3.7.13/lib/python3.7/site-packages/odoo_module_migrate/__main__.py", line 144, in main
    migration.run()
  File "/home/are/.pyenv/versions/3.7.13/lib/python3.7/site-packages/odoo_module_migrate/migration.py", line 221, in run
    module_migration.run()
  File "/home/are/.pyenv/versions/3.7.13/lib/python3.7/site-packages/odoo_module_migrate/module_migration.py", line 36, in run
    self._migration._commit_enabled
  File "/home/are/.pyenv/versions/3.7.13/lib/python3.7/site-packages/odoo_module_migrate/base_migration_script.py", line 152, in run
    tools=tools,
  File "/home/are/.pyenv/versions/3.7.13/lib/python3.7/site-packages/odoo_module_migrate/migration_scripts/migrate_130_140.py", line 144, in reformat_deprecated_tags
    reformatted_file = _reformat_file(file_path)
  File "/home/are/.pyenv/versions/3.7.13/lib/python3.7/site-packages/odoo_module_migrate/migration_scripts/migrate_130_140.py", line 106, in _reformat_file
    et.indent(tag, space=indent, level=1)
AttributeError: module 'lxml.etree' has no attribute 'indent'

I cannot provide the view that triggers this error because the module I was migrating is private, however the issue I'm pretty sure it does not depends from a particular view definition.

I suggest to add minimum required versions to the requirements.txt. That should be trivial to implement, and it would make the project more robust.

Affected versions:

0.4.0

Additional context

Tested on Linux (Ubuntu 18.04), Python 3.6.15 and 3.7.13.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions