masaccio / numbers-parser

Python module for parsing Apple Numbers .numbers files
MIT License
203 stars 15 forks source link

About the protobuf version #91

Open Deng-yongbiao opened 4 days ago

Deng-yongbiao commented 4 days ago

Thanks for your contribution, it's a very good job.

I would like to ask about the version of protobuf that generates files corresponding to python from proto files, because I need to use the corresponding c++ source files.

masaccio commented 4 days ago

I use Homebrew on a Mac to handle the binary dependencies and it used 28.2. If you are reasonably familiar with Python and command-line dependencies, you should be able to clone the repo and run the various parts of make bootstrap. This will generate the .proto files using a Python protodump. This is basically:

mkdir -p .bootstrap/protos
poetry run python3 src/build/protodump.py /Applications/Numbers.app .bootstrap/protos
poetry run python3 src/build/rename_proto_files.py .bootstrap/protos
mkdir -p src/numbers_parser/generated
for proto in .bootstrap/protos/*.proto; do \
        /usr/local/bin/protoc -I=.bootstrap/protos --proto_path .bootstrap/protos --python_out=src/numbers_parser/generated $proto; \
    done

You probably don't need to go as far as using Poetry to run the dump scripts as I don't think they have unusual dependencies.