appnexus / pyrobuf

A Cython alternative to Google's Python Protobuf library
Other
554 stars 76 forks source link

Great idea, docs dont seem right #132

Open DuaneNielsen opened 5 years ago

DuaneNielsen commented 5 years ago

First, let me say, the idea for this module is awesome, there is definately a need for a pure python oriented version of protobuf.

Problem I ran into was that the "Distributing a Python Package with Pyrobuf Modules" section of the docs seems to be not so well supported.

First, there seems to be a bug in compile.py under python 3.6

    def _compile_spec(self):
        try:
            os.makedirs(self.out)
        except _FileExistsError:
            pass

        for source in self.sources:
            if os.path.isdir(source):
                for spec in glob.glob(os.path.join(source, '*.proto')):
                    self._generate(spec)
            else:
                self._generate(source)

The line "for source in self.sources" appears to iterate over each character of the string, instead of a set of modules.

Renaming the directory from 'proto' to 'p' solved that problem. But then nothing was generated.

It migth be helpful to test this code under python 3.6, and also to mention in the docs, which setup commands will generate the files.

wrobell commented 5 years ago

I can confirm the issue. setuptools tries to read directory using first letter from pyrobuf_modules. You can set it to 'proto' or ['proto'] and it will try to read p directory.