Gentoo Archives: gentoo-soc

From: "Jiale Pan(Kyle Pan)" <kyle.j.pan@×××××.com>
To: Serkan Kaba <serkan@g.o>
Cc: gentoo-soc@l.g.o
Subject: [gentoo-soc] Re: Gentoo/Java IDE integration-- Daily report--Kylepan
Date: Tue, 07 Jun 2011 15:20:40
Message-Id: 4DEE40FC.5080902@gmail.com
1 On 2011年06月07日 14:08, Serkan Kaba wrote:
2 > 2011/6/6 Kyle Pan<kyle.j.pan@×××××.com>:
3 >> On Mon, Jun 6, 2011 at 14:48, Serkan Kaba<serkan@g.o> wrote:
4 >>> 2011/6/5 Kyle Pan<kyle.j.pan@×××××.com>:
5 >>>> I've tried modified the main scripts(/usr/bin/java-config-2-2.6) to a
6 >>>> module. The modified java-config-2 version and a new version of
7 >>>> QueryEnvDemo(QueryEnvDemo2.java) have been updated to svn.
8 >>> Great. This makes it more programmattic. When do you plan to make an
9 >>> api around it (instead of a simple demo)?
10 >>
11 >> right now I'm working on trying to develop the plugin's UI. It would
12 >> be a few days I think.
13 >> Can I do it as soon as this finishes. (And could you explain more
14 >> about what do you "make an api around"..
15 >> very sorry that I don't understand the phrase very clear ,er....)
16 >>
17 > Sorry I should have made it clearer. Currently there are methods
18 > defined in Python. You should make the accompanying Java API that
19 > accesses those methods. Your upper layers shouldn't call Python code
20 > directly.
21
22 I've added class containing accompanying Java API that acts as wrappers,
23 to access methods in java_config_2_api instead of directly calling them.
24 It is committed to svn companied with a test class. Please check whether
25 I've catch your meaning when you have time.( I think yes:) Thanks.
26
27
28 >>>>
29 >>>> In order to change java-config-2 to a Python module to use in
30 >>>> program, besides some modifications in its code, the ultimately
31 >>>> installed filename(/usr/bin/java-config-2-2.6) should be changed, for
32 >>>> hyphen and dot cannot be use as module identifiers and .py should be
33 >>>> added.(see my QueryEnvDemo2). And my chosen name is
34 >>>> java_config_2_2_6.py
35 >>>>
36 >>>> So to run the demo:
37 >>>> After emerging the modified java-config-2
38 >>>> (still use this ebuild[1])
39 >>>> should manually change /usr/bin/java-config-2-2.6 to
40 >>>> /usr/bin/java_config_2_2_6.py
41 >>> I don't think version number should be hyphened as well but not sure.
42 >> If a python script wanna be a module, it's name cannot contain
43 >> hyphen and dot--otherwise it cannot be imported--I've tried.
44 >>
45 >>>>
46 >>>>
47 >>>> issues:
48 >>>> currently the filename change is done manually, and it definitely
49 >>>> should be installed(emerging) with the right name automatically. How
50 >>>> to do it seems a little bit complicated and I don't know, though I've
51 >>>> already done some inspections:
52 >>>>
53 >>>> when user calls java-config in shell,
54 >>>> /usr/bin/java-config executes,
55 >>>> it's a shell script and actually executes /usr/bin/java-config-2.
56 >>>>
57 >>>> /usr/bin/java-config-2 seems rather complicated but I still got what it does:
58 >>>> /usr/bin/java-config-2 does some checks and finally choose to execute
59 >>>> /usr/bin/java-config-2-2.6 or /usr/bin/java-config-2-3.1 according to
60 >>>> what it finds.
61 >>>>
62 >>>> So if I change the name of /usr/bin/java-config-2-2.6, the
63 >>>> /usr/bin/java-config-2 script should also be changed accordingly.
64 >>>> However, I should not change it directly, it's header says it is
65 >>>> generated by python_generate_wrapper_scripts(). But I don't know what
66 >>>> the original script is.
67 >>> That's generated by distutils. You may change the source file name
68 >>> with underscores but we need to examine whether it effects other
69 >>> packages. (java-config-wrapper is definetely effected)
70 >>
71 >> I find the code place to change the filename: setup.py in project's
72 >> root directory.
73 >> the code snippet:
74 >>
75 >> package_dir = { 'java_config_2' : 'src/java_config_2' },
76 >> scripts = ['src/java-config-2','src/depend-java-query','src/run-java-tool',
77 >> 'src/gjl'],
78 >> data_files = [
79 >>
80 >> I change the second line to:(of course the file src/java-config-2 is
81 >> renamed to java_config_2.py before doing this)
82 >> scripts = ['src/java_config_2.py','src/depend-java-query','src/run-java-tool',
83 >> 'src/gjl'],
84 >>
85 >> and it emerged well,
86 >>
87 >> BUT this still CANNOT achieve what I want, the resulting file name
88 >> after emerging becomes:
89 >>
90 >> /usr/bin/java_config_2.py-2.6
91 >> /usr/bin/java_config_2.py-3.1
92 >>
93 >> it seems that distutils always add -2.6 and -3.1 automatically. And I
94 >> think it's not proper to modify distutils for
95 >> it is maintained by Python(isn't it?).
96 >> So this method isn't a solution I think.
97 >>
98 >> And I propose another solution:
99 >> I can
100 >> cp ${project's root}/java-config-2 ${project's
101 >> root}/src/java_config_2/java_config_2.py
102 >>
103 >> and then making necessary small code modifications to let it can be
104 >> used a module.
105 >> modules in ${project's root}/src/java_config_2/ will be installed to
106 >> /usr/lib/python2.6/site-packages/java_config_2/ automatically
107 >> with the original filename. Doing this can leaving the original
108 >> java-config-2 file intact as well as not messing dealing
109 >> with changes to java-config-wrapper project
110 >>
111 >> What do you think?
112 >>
113 >>
114 >>
115 >>
116 >>
117 >> --
118 >> Best Regards,
119 >> Jiale Pan (Kyle Pan)
120 >>
121 >
122 > What I suggest is to extract the API part to seperate file that can be
123 > imported as a module (for example java_config_2_api).
124 >
125
126 I have updated the java_config_2_api.py to svn, containing the minimal
127 required function I currently need. I didn't delete the other ones(
128 instead, I commented) because if I find that I need another one in it
129 during my development, I can easily uncomment and use it. However,
130 they'll be cleaned up after all the plugin work finishes.
131 > Regards,
132 > Serkan
133 >
134
135
136 --
137 Best regards,
138 Jiale Pan(Kyle Pan)