Commit Graph

338 Commits

Author SHA1 Message Date
Giacomo Vercesi 35b65797eb python: integrate README.md into python package
Allow the README of each respective package to be read by the build
machinery to integrate it into the packages' metadata.
2025-07-15 10:46:19 +02:00
Giacomo Vercesi 5a05b834ed python: autogenerate module version for wheels
Autogenerate a different version for wheels every time the project is
configured.
2025-07-15 10:46:19 +02:00
Giacomo Vercesi 8484f3c4b8 Fix backslash in f-string causing an error
In python versions prior to 3.12, using a backslash in an f-string would
cause a `SyntaxError`, change the expression to use string
concatenation.
2025-07-11 17:06:13 +02:00
Giacomo Vercesi e8198eb862 pyproject.toml: add missing dependencies 2025-07-11 17:05:51 +02:00
Ivan Krysak 452612eaea import-idb: fix misuse of PrimitiveType object 2025-06-27 17:42:27 +03:00
Giacomo Vercesi d62b7b6b1a TTG: inline root type in schema
Move the root type inside the schema definition, as it is a property of
it and not of the generator.
2025-06-25 15:40:13 +02:00
Giacomo Vercesi 087192cac4 mass-testing: add max_rss to database
Add the `max_rss` column to the database generated by the `revng
mass-testing generate-report` command.
2025-06-04 13:30:42 +02:00
Giacomo Vercesi deeae6d904 mass-testing run: auto-detect max-jobs
With the information propagated by `meta.yml`, compute the maximum
number of jobs based on the max memory limit.
2025-06-04 13:30:42 +02:00
Giacomo Vercesi f63cd5ff6f mass-testing configure: add env to sample
Add an environment variable to the `revng mass-testing configure`
command that allows sampling the inputs to a limited amount.
2025-06-04 13:30:42 +02:00
Giacomo Vercesi 6e59f45c89 mass-testing configure: add env for seed
Add an environment variable that allows setting the seed of the RNG for
`revng mass-testing configure`. Drop the `--seed` command line option.
2025-06-04 13:30:42 +02:00
Giacomo Vercesi 14f951effe mass-testing configure: change input format
Change the input format accepted by the `revng mass-testing configure`
command. This allows knowing in `meta.yml` the limits (ram, time)
imposed on each test set.
2025-06-04 13:30:41 +02:00
Giacomo Vercesi 8b9aad7292 mass-testing generate-report: fix exception
Fix an exception that happened when generating the report. In some cases
the `stacktrace.json` file has a line like this:
```
{"Address":"0x7f7","Error":{"Message":"No such file or directory"},"ModuleName":"linux-vdso.so.1"}
```
This is a valid line that maps to `(linux-vdso.so.1+0x7f7)`, however
this was not properly handled in the code. This commits fixes it so that
a dummy line is added and the line is skipped.
2025-06-04 13:30:41 +02:00
Giacomo Vercesi 130a2bfc9f Command: fix typing of command in constructor 2025-06-04 13:30:41 +02:00
Ivan Krysak f3cce00c3f Migrations: fix the template 2025-05-08 15:42:01 +02:00
Ivan Krysak 0d868894a2 model::Function: switch to indices as comment keys 2025-05-08 15:42:00 +02:00
Giacomo Vercesi 89b17d2325 Python client: add user manual 2025-05-07 12:04:15 +02:00
Giacomo Vercesi 890a735610 test_docs: add ignoreoutput option for python
Sometimes the output of a command is not important, in these cases
`doctest` complains nonetheless. This commit introduces a
`IGNORE_OUTPUT` option which still allows checking that the command
executes correctly but skips the checking of the output with the
expected one. In addition to this the `test_docs` command now can parse
a `ignoreoutput` option in the python block which will:
* if numbers are specified (e.g. `ignoreoutput=1,2`): the specified
  line numbers will have `# doctest: +IGNORE_OUTPUT` added at the end
  of the specified line numbers.
* Without numbers (e.g. `{python ignoreoutput}`) then all lines will
  have a `# doctest: +IGNORE_OUTPUT` appended.
2025-05-07 10:48:54 +02:00
Giacomo Vercesi 3e3779498e Implement python interface for revng
Add a python interface (`revng.profile`) for interacting with the rev.ng
infrastructure as a whole; either through the CLI (`CLIProject`) or the
GraphQL API (`DaemonProject`).
2025-05-07 10:48:51 +02:00
Giacomo Vercesi de997ca2e4 python TTG: add mixins infrastructure
Add the infrastructure code needed to allow to add mixins to Tuple-Tree
Generated classes in python.
2025-05-07 10:48:50 +02:00
Giacomo Vercesi 0f6b6e00bd Add revng init
Add a new `revng` command that allows to initialize a resume directory.
2025-05-07 10:48:49 +02:00
Giacomo Vercesi 8ba134bb45 TypedList: also implement mapping functions
Allow `TypedList`s to also be used as a dictionary-like structure if
the base class is keyable.
2025-05-07 10:48:47 +02:00
Giacomo Vercesi d8fffc0980 Improve Python's TTG typing
Improve the typing signatures in a few place in the `revng.tupletree`
package and in the auto-generated python TTGs.
2025-05-07 10:48:46 +02:00
Jurij Srebrnič 3050b291b1 Implement diff and apply for python model wrapper
Add the necessary code for the python model wrapper to allow diffing and
applying a diff.
2025-05-07 10:48:45 +02:00
Jurij Srebrnič 3bc63b833e Fixed python and typescript doc-test not executing 2025-05-07 10:48:23 +02:00
Giacomo Vercesi e95ad01ff8 Implement revng llm-rename 2025-05-05 17:28:48 +02:00
Giacomo Vercesi 591107cdce Overhaul PTML functionality
The logic of the `revng ptml` command was too tightly coupled with the
parsing of the xml. Overhaul the structure of the ptml code and split it
in two locations:
* `revng.ptml`: this module contains functions that allow easy
  manipulation of PTML, both for printing it and for obtaining the split
  metadata/text version.
* `revng.internal.cli._commands.ptml`: this implements the actual `revng
  ptml` command. This leverages the new logic in the `revng.ptml` module
  while maintaining the same functionality.
2025-05-05 17:28:48 +02:00
Giacomo Vercesi bfed42ed1e Add revng.support.get_llvmcpy helper
Add the `get_llvmcpy` helper function which returns an instance of
`LLVMCPy` which uses the `llvm-config` that's present in the search
paths.
2025-05-05 16:02:40 +02:00
Giacomo Vercesi 6fc6d38228 Remove argparse.FileType
Python 3.14 will deprecate `argparse.FileType` [1]. This is due to a
variety of factors, one of which is that the class leaks file
descriptors when used. Remove all usages in the codebase and instead
use a wrapper function for `open`.

[1] https://docs.python.org/3.14/library/argparse.html#argparse.FileType
2025-05-05 16:02:40 +02:00
Giacomo Vercesi 57c4f89dd3 python: remove relative imports
Remove all the relative imports from the python code that are not
relative to the current module (e.g. `from .<X> import ...`).
2025-05-05 16:02:40 +02:00
Giacomo Vercesi 4757d57d59 StorageSaver: fetch initial credentials
Fetch the credentials contained in the URL from the `Synchronizer` when
initializing `StorageSaver`.
2025-05-05 16:02:40 +02:00
Giacomo Vercesi 19a3eb39c6 tupletree: suppress naming error
Suppress the flake8 error N808, due to the variables beginning with `_`.
2025-05-05 16:02:40 +02:00
Khaled Ismaeel 9d80594ddc Bump model version to v3 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 8b355fc896 Add primitive support for generating migrations 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 9b07b3bcce Add primitive migration support to the CLI 2025-04-30 15:08:45 +02:00
Khaled Ismaeel 7156cace7b Drop multiversion support in Python model wrapper 2025-04-30 15:08:45 +02:00
Giacomo Vercesi 6509cad084 test_docs: remove useless global
The `verbose` was is not modified in the `log` function, so the use of
`global` is useless.
2025-04-24 13:22:14 +02:00
Ivan Krysak ae3f19664a ModelPasses: introduce fix-model 2025-04-17 11:19:17 +03:00
Ivan Krysak 0c99d5d5fb IDBImporter: omit unnecessary typedefs 2025-04-17 11:19:17 +03:00
Ivan Krysak 2eed7f2410 IDBImporter: fix an incorrect type check 2025-04-17 11:19:17 +03:00
Ivan Krysak c4f071dfe3 Importers: adopt primitive typedef flattening 2025-04-17 11:19:17 +03:00
Ivan Krysak 433af9ef6e Adopt the new name deduplication pass 2025-04-17 11:19:17 +03:00
Ivan Krysak f070f1f1e1 Model: sunset double name system 2025-04-17 11:19:17 +03:00
Giacomo Vercesi 38aefea930 ResettableTimer: fix deadlock
The `ResettableTimer` class' code did not account for the `function`
attribute to possibly call the timer, creating a deadlock because the
lock was already taken while calling the function. Move the function
call out of the lock.
2025-04-07 10:36:36 +02:00
Giacomo Vercesi e634861c1a Implement SyncingManager
Implement the SyncingManager class which wraps the Manager and implements
save syncing features, which comprise autosave and saving via
synchronizers.
2025-04-03 15:59:18 +02:00
Giacomo Vercesi 6a10419b69 Implement S3Synchronizer
Implement a downstream load/save handler in `revng.internal.api.Manager`
class which handles loading and saving files from a local directory to
a s3 server.
2025-03-28 14:23:10 +01:00
Giacomo Vercesi d9e928dce9 fetch debuginfo: provide alternative urls via env
Allow the `fetch debuginfo` command to have the upstream server urls be
provided via environment variables rather than the command-line.
2025-03-13 18:03:50 +01:00
Giacomo Vercesi f6b9e509a3 fetch debuginfo: actually check for PE/COFF
Add the code needed to check if the input file is actually a PE/COFF
file.
2025-03-13 18:03:50 +01:00
Giacomo Vercesi fa44c4cf2f fetch debuginfo: drop self.verbose
The `FetchDebugInfoCommand` contained assignment to `self.verbose` which
was unused. Drop it.
2025-03-13 18:03:50 +01:00
Giacomo Vercesi ca26c06ecc EventManager: fix save logic
Fix the save logic of `EventManager` where an erroneous comparison lead
to the saves never being triggered.
2025-02-25 09:18:24 +01:00
Giacomo Vercesi 74cbb83d10 fetch-debuginfo: add retries
Add retries when fetching debugging symbols via the `revng model
fetch-debuginfo` command. Retries only apply when the status code
returned by the server is within the expected ones.
2025-02-24 18:17:47 +01:00