* [gentoo-soc] Re: Gentoo/Java IDE integration-- Daily report--Kylepan
[not found] ` <BANLkTimb-jFE6P_ZocFNifLbJ8BERKeBZA@mail.gmail.com>
@ 2011-06-07 15:17 ` Jiale Pan(Kyle Pan)
0 siblings, 0 replies; only message in thread
From: Jiale Pan(Kyle Pan) @ 2011-06-07 15:17 UTC (permalink / raw
To: Serkan Kaba; +Cc: gentoo-soc
On 2011年06月07日 14:08, Serkan Kaba wrote:
> 2011/6/6 Kyle Pan<kyle.j.pan@gmail.com>:
>> On Mon, Jun 6, 2011 at 14:48, Serkan Kaba<serkan@gentoo.org> wrote:
>>> 2011/6/5 Kyle Pan<kyle.j.pan@gmail.com>:
>>>> I've tried modified the main scripts(/usr/bin/java-config-2-2.6) to a
>>>> module. The modified java-config-2 version and a new version of
>>>> QueryEnvDemo(QueryEnvDemo2.java) have been updated to svn.
>>> Great. This makes it more programmattic. When do you plan to make an
>>> api around it (instead of a simple demo)?
>>
>> right now I'm working on trying to develop the plugin's UI. It would
>> be a few days I think.
>> Can I do it as soon as this finishes. (And could you explain more
>> about what do you "make an api around"..
>> very sorry that I don't understand the phrase very clear ,er....)
>>
> Sorry I should have made it clearer. Currently there are methods
> defined in Python. You should make the accompanying Java API that
> accesses those methods. Your upper layers shouldn't call Python code
> directly.
I've added class containing accompanying Java API that acts as wrappers,
to access methods in java_config_2_api instead of directly calling them.
It is committed to svn companied with a test class. Please check whether
I've catch your meaning when you have time.( I think yes:) Thanks.
>>>>
>>>> In order to change java-config-2 to a Python module to use in
>>>> program, besides some modifications in its code, the ultimately
>>>> installed filename(/usr/bin/java-config-2-2.6) should be changed, for
>>>> hyphen and dot cannot be use as module identifiers and .py should be
>>>> added.(see my QueryEnvDemo2). And my chosen name is
>>>> java_config_2_2_6.py
>>>>
>>>> So to run the demo:
>>>> After emerging the modified java-config-2
>>>> (still use this ebuild[1])
>>>> should manually change /usr/bin/java-config-2-2.6 to
>>>> /usr/bin/java_config_2_2_6.py
>>> I don't think version number should be hyphened as well but not sure.
>> If a python script wanna be a module, it's name cannot contain
>> hyphen and dot--otherwise it cannot be imported--I've tried.
>>
>>>>
>>>>
>>>> issues:
>>>> currently the filename change is done manually, and it definitely
>>>> should be installed(emerging) with the right name automatically. How
>>>> to do it seems a little bit complicated and I don't know, though I've
>>>> already done some inspections:
>>>>
>>>> when user calls java-config in shell,
>>>> /usr/bin/java-config executes,
>>>> it's a shell script and actually executes /usr/bin/java-config-2.
>>>>
>>>> /usr/bin/java-config-2 seems rather complicated but I still got what it does:
>>>> /usr/bin/java-config-2 does some checks and finally choose to execute
>>>> /usr/bin/java-config-2-2.6 or /usr/bin/java-config-2-3.1 according to
>>>> what it finds.
>>>>
>>>> So if I change the name of /usr/bin/java-config-2-2.6, the
>>>> /usr/bin/java-config-2 script should also be changed accordingly.
>>>> However, I should not change it directly, it's header says it is
>>>> generated by python_generate_wrapper_scripts(). But I don't know what
>>>> the original script is.
>>> That's generated by distutils. You may change the source file name
>>> with underscores but we need to examine whether it effects other
>>> packages. (java-config-wrapper is definetely effected)
>>
>> I find the code place to change the filename: setup.py in project's
>> root directory.
>> the code snippet:
>>
>> package_dir = { 'java_config_2' : 'src/java_config_2' },
>> scripts = ['src/java-config-2','src/depend-java-query','src/run-java-tool',
>> 'src/gjl'],
>> data_files = [
>>
>> I change the second line to:(of course the file src/java-config-2 is
>> renamed to java_config_2.py before doing this)
>> scripts = ['src/java_config_2.py','src/depend-java-query','src/run-java-tool',
>> 'src/gjl'],
>>
>> and it emerged well,
>>
>> BUT this still CANNOT achieve what I want, the resulting file name
>> after emerging becomes:
>>
>> /usr/bin/java_config_2.py-2.6
>> /usr/bin/java_config_2.py-3.1
>>
>> it seems that distutils always add -2.6 and -3.1 automatically. And I
>> think it's not proper to modify distutils for
>> it is maintained by Python(isn't it?).
>> So this method isn't a solution I think.
>>
>> And I propose another solution:
>> I can
>> cp ${project's root}/java-config-2 ${project's
>> root}/src/java_config_2/java_config_2.py
>>
>> and then making necessary small code modifications to let it can be
>> used a module.
>> modules in ${project's root}/src/java_config_2/ will be installed to
>> /usr/lib/python2.6/site-packages/java_config_2/ automatically
>> with the original filename. Doing this can leaving the original
>> java-config-2 file intact as well as not messing dealing
>> with changes to java-config-wrapper project
>>
>> What do you think?
>>
>>
>>
>>
>>
>> --
>> Best Regards,
>> Jiale Pan (Kyle Pan)
>>
>
> What I suggest is to extract the API part to seperate file that can be
> imported as a module (for example java_config_2_api).
>
I have updated the java_config_2_api.py to svn, containing the minimal
required function I currently need. I didn't delete the other ones(
instead, I commented) because if I find that I need another one in it
during my development, I can easily uncomment and use it. However,
they'll be cleaned up after all the plugin work finishes.
> Regards,
> Serkan
>
--
Best regards,
Jiale Pan(Kyle Pan)
^ permalink raw reply [flat|nested] only message in thread