You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by Joshua Campbell <jo...@ualberta.ca> on 2017/07/11 15:30:46 UTC

Building a class with JCC from setup.py

Does anyone know how to do this? I don't want to install the java
stuff as its own thing like python -m jcc --install... I just want to
include it as a submodule of a package I already have.

-- 
Joshua Charles Campbell
Ph.D. Student and Research Assistant
Department of Computing Science
University of Alberta
joshua2@ualberta.ca

Re: Building a class with JCC from setup.py

Posted by Andi Vajda <va...@apache.org>.
On Tue, 11 Jul 2017, Joshua Campbell wrote:

> Would it be possible to abstract about parts of the compile routine
> from python.py so that I could have a setup.py that does like:
>
> from setuptools import setup
> from jcc import jcc_extension
>
> my_extension = jcc_extension(
>    name='py_lex_java'
>    clases=['ca.ualberta.cs.ScannerWrapper'],
>    includes=['target/lex-java-1.0-SNAPSHOT-jar-with-dependencies.jar'],
>    )

Neat idea !
Patches welcome !

Andi..

>
> setup(
>    name='py_lex_java',
>    version="1.8.1",
>    description='Call the Java Compiler\'s lexer from Python.',
>    long_description=open('README.txt').read(),
>    author='Joshua Campbell',
>    author_email='py_lex_java@orezpraw.com',
>    url='https://github.com/naturalness/py-lex-java',
>    license='GPLv3+',
>    packages=['py_lex_java'],
>    zip_safe=False,
>    ext_modules=[my_extension.ext_module],
>    'package_dir': {'py_lex_java': my_extension.package_dir},
>    'package_data': {'py_lex_java': my_extension.package_data},
> )
>
> On Tue, Jul 11, 2017 at 12:00 PM, Joshua Campbell <jo...@ualberta.ca> wrote:
>> I thought of it but I have other, swig-based modules that are also
>> built by my setup.py...
>>
>> So I gave up on that but then how do I specify the things that aren't
>> package name or version to setup(), such as description,
>> long_description, author, author_email, url, license?
>>
>> On Tue, Jul 11, 2017 at 10:00 AM, Andi Vajda <va...@apache.org> wrote:
>>>
>>>> On Jul 11, 2017, at 08:30, Joshua Campbell <jo...@ualberta.ca> wrote:
>>>>
>>>> Does anyone know how to do this? I don't want to install the java
>>>> stuff as its own thing like python -m jcc --install... I just want to
>>>> include it as a submodule of a package I already have.
>>>
>>> I think you add python files on the jcc command line (there should be exhaustive help in its __main__.py file). You might then be able to build your package and your java stuff as one jcc thing.
>>>
>>> Andi..
>>>
>>>>
>>>> --
>>>> Joshua Charles Campbell
>>>> Ph.D. Student and Research Assistant
>>>> Department of Computing Science
>>>> University of Alberta
>>>> joshua2@ualberta.ca
>>>
>>
>>
>>
>> --
>> Joshua Charles Campbell
>> Ph.D. Student and Research Assistant
>> Department of Computing Science
>> University of Alberta
>> joshua2@ualberta.ca
>
>
>
> -- 
> Joshua Charles Campbell
> Ph.D. Student and Research Assistant
> Department of Computing Science
> University of Alberta
> joshua2@ualberta.ca
>

Re: Building a class with JCC from setup.py

Posted by Joshua Campbell <jo...@ualberta.ca>.
Would it be possible to abstract about parts of the compile routine
from python.py so that I could have a setup.py that does like:

from setuptools import setup
from jcc import jcc_extension

my_extension = jcc_extension(
    name='py_lex_java'
    clases=['ca.ualberta.cs.ScannerWrapper'],
    includes=['target/lex-java-1.0-SNAPSHOT-jar-with-dependencies.jar'],
    )

setup(
    name='py_lex_java',
    version="1.8.1",
    description='Call the Java Compiler\'s lexer from Python.',
    long_description=open('README.txt').read(),
    author='Joshua Campbell',
    author_email='py_lex_java@orezpraw.com',
    url='https://github.com/naturalness/py-lex-java',
    license='GPLv3+',
    packages=['py_lex_java'],
    zip_safe=False,
    ext_modules=[my_extension.ext_module],
    'package_dir': {'py_lex_java': my_extension.package_dir},
    'package_data': {'py_lex_java': my_extension.package_data},
)

On Tue, Jul 11, 2017 at 12:00 PM, Joshua Campbell <jo...@ualberta.ca> wrote:
> I thought of it but I have other, swig-based modules that are also
> built by my setup.py...
>
> So I gave up on that but then how do I specify the things that aren't
> package name or version to setup(), such as description,
> long_description, author, author_email, url, license?
>
> On Tue, Jul 11, 2017 at 10:00 AM, Andi Vajda <va...@apache.org> wrote:
>>
>>> On Jul 11, 2017, at 08:30, Joshua Campbell <jo...@ualberta.ca> wrote:
>>>
>>> Does anyone know how to do this? I don't want to install the java
>>> stuff as its own thing like python -m jcc --install... I just want to
>>> include it as a submodule of a package I already have.
>>
>> I think you add python files on the jcc command line (there should be exhaustive help in its __main__.py file). You might then be able to build your package and your java stuff as one jcc thing.
>>
>> Andi..
>>
>>>
>>> --
>>> Joshua Charles Campbell
>>> Ph.D. Student and Research Assistant
>>> Department of Computing Science
>>> University of Alberta
>>> joshua2@ualberta.ca
>>
>
>
>
> --
> Joshua Charles Campbell
> Ph.D. Student and Research Assistant
> Department of Computing Science
> University of Alberta
> joshua2@ualberta.ca



-- 
Joshua Charles Campbell
Ph.D. Student and Research Assistant
Department of Computing Science
University of Alberta
joshua2@ualberta.ca

Re: Building a class with JCC from setup.py

Posted by Joshua Campbell <jo...@ualberta.ca>.
I thought of it but I have other, swig-based modules that are also
built by my setup.py...

So I gave up on that but then how do I specify the things that aren't
package name or version to setup(), such as description,
long_description, author, author_email, url, license?

On Tue, Jul 11, 2017 at 10:00 AM, Andi Vajda <va...@apache.org> wrote:
>
>> On Jul 11, 2017, at 08:30, Joshua Campbell <jo...@ualberta.ca> wrote:
>>
>> Does anyone know how to do this? I don't want to install the java
>> stuff as its own thing like python -m jcc --install... I just want to
>> include it as a submodule of a package I already have.
>
> I think you add python files on the jcc command line (there should be exhaustive help in its __main__.py file). You might then be able to build your package and your java stuff as one jcc thing.
>
> Andi..
>
>>
>> --
>> Joshua Charles Campbell
>> Ph.D. Student and Research Assistant
>> Department of Computing Science
>> University of Alberta
>> joshua2@ualberta.ca
>



-- 
Joshua Charles Campbell
Ph.D. Student and Research Assistant
Department of Computing Science
University of Alberta
joshua2@ualberta.ca

Re: Building a class with JCC from setup.py

Posted by Andi Vajda <va...@apache.org>.
> On Jul 11, 2017, at 08:30, Joshua Campbell <jo...@ualberta.ca> wrote:
> 
> Does anyone know how to do this? I don't want to install the java
> stuff as its own thing like python -m jcc --install... I just want to
> include it as a submodule of a package I already have.

I think you add python files on the jcc command line (there should be exhaustive help in its __main__.py file). You might then be able to build your package and your java stuff as one jcc thing.

Andi..

> 
> -- 
> Joshua Charles Campbell
> Ph.D. Student and Research Assistant
> Department of Computing Science
> University of Alberta
> joshua2@ualberta.ca