-
-
Notifications
You must be signed in to change notification settings - Fork 632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add-on packaging #213
Comments
Comment 1 by jteh on 2008-11-02 20:09
|
Comment 2 by Bernd on 2009-02-22 02:45 |
Comment 3 by jteh on 2011-12-13 07:04 We need add-on packages because many users aren't comfortable with extracting files into specific locations and it is often difficult to explain where files should be extracted. My current thinking is outlined below. Package format:
Installation:
Management:
Misc technical:
|
Comment 4 by aleksey_s (in reply to comment 3) on 2011-12-13 18:47
may be a wiki page of specific format, to be easily programatically parsed for automatic discovering.
the later can be useful for automatic NVDA file association. Installer should associate .NVDAAddon file extension with NVDA for convenience.
Description should be localizable. maybe it is worth making metadata inside the extension python code. This way, if developer does cary about localization, he has a way to return localized strings.
as well as other addon specific files (configuration, localization etc).
Anyway, we need some sort of registry of installed addons. therefore, we can store list of files related to each addon. So, is it worth creating a separate dir for each addon, considering that almost 100% of those will be only one thing (app module, synth, braille display driver or global plugin)? |
Comment 5 by ragb (in reply to comment 3) on 2011-12-19 19:07
+1
When I read this the first thing that came to mind was python egg files: Those are much coppled with setuptools and such but, if things are done right in those libraries, maybe stuff can be reused. More on that billow.
Do you think that something similar a setup.py won't work? I can see some security problems but the same already applies for any plugin that can execute python code. That would possibly solve the description localization issue pointed by alexei in another comment.
One can add those to python path using pkg_resources machinery quite easily. Actually I think that it is even not necessary to extract the zip file (assuming that will be a zip file) for many packages since python can import from zip files. However that can possibly create problems with loading of not-python data such as dlls, sounds, etc.
Seems good.
When I thought about setuptools/distutils/distribute it was also for this purpose. It is very reasonable that some add-on would depend on another one so updating and dependency tracking could be eventually needed. Because one does not need to reenvent things when they exist (unless they don't exist) I think that those might be a starting point.
Ok, the pkg_resources mentioned above. Regards, Rui Batista |
Comment 6 by ragb on 2011-12-28 22:39 In my previous comment when it reads pkg_resources it should be pkgutils. pkg_resources another different thing. Anyway, I've been reading some parts of NVDA source code (to update myself on things) and in my opinio, with the current state of the code, this packaging thing is not as hard as I thought before. If needed I can work on this since I have to do something else than my master thesis to not get mad... I don't think I have accessibility related skills to help with more iaccessible and friends related stuff but on this field I can colaborate. So, if you want I can try to implement this packaging thing, or at least some parts of it. |
Comment 7 by jteh (in reply to comment 4) on 2011-12-28 23:09
This isn't possible for portable users, so I was a bit reluctant to do something special for the installer, as it makes documentation tricky; i.e. you have to document one method for the installer and one method for the portable. However, I admit it would be simpler this way. Also, I'd prefer an extension like nvdaAddon.zip so that it's clear it's a zip archive and developers don't have to rename it, but Windows extension association may not handle this.
I thought of doing this with Python code. It would be simpler for a lot of reasons. However, it presents a major security problem. The module could contain harmful code which would be executed before the user had even confirmed installation of the package, which is very bad. Perhaps the metadata file will have to contain text for each locale. Ugly.
That's what I said: userConfig\addons\packageName. App modules would be in userConfig\addons\packageName\appModules, etc. |
Comment 8 by jteh (in reply to comment 5) on 2011-12-28 23:18
I'm reluctant to use setuptools because it contains a lot of extra stuff that we don't need, which would therefore unnecessarily increase the size of the NVDA distribution.
That's true, but this will be loaded before the user even accepts installation of the package to display the name, publisher, description, etc. of the package. If the user accepts installation, they accept the possible security risk. However, loading code before the user even accepts this risk is unacceptable. That would possibly solve the description localization issue pointed by alexei in another comment.
We already have code to handle this. See config.addConfigDirsToPythonPackagePath. We'd need to modify this slightly.
I think it's best to always extract, as a lot of packages will depend on data which must be extracted.
I'm happy for you to investigate this and report here. However, I am very concerned about unnecessary code in setuptools. Also, handling dependencies is problematic, as then you have to be concerned about automatic downloads, etc., not to mention the GUI for this. That said, I haven't actually investigated setuptools at all yet. |
Comment 9 by ragb (in reply to comment 7) on 2011-12-29 18:15
I guess that is the simplest option. NVDA installer already does something like this. Maybe this implies the usage of a more structured format for the plugin manifest data (say xml, json, etc). This can also be more extensible for the future than .ini files for instance. |
Comment 10 by ragb (in reply to comment 8) on 2011-12-29 18:20
That is really something to take in consideration.
Yes. Python code for the plugin data does not work.
Yes, I checked that. That is great.
Yes, it esimplifies things alot. Python zipfile module has all it is needed, I think.
Will do. |
Comment 11 by jteh on 2012-01-05 08:04
|
Comment 12 by jteh on 2012-01-05 08:05 |
Comment 13 by jteh on 2012-01-05 08:06 |
Comment 14 by ragb (in reply to comment 12) on 2012-01-05 11:37
Is this also valid for stable releases or just snapshots from BZR? I can't get with anything in i.g. 2011.3 or 2012.1beta1 or any of the variations used that goes against the versions schema described in setuptools. With snapshots that is true, starting from the usage of dashes between thre brance's name and revision number. |
Comment 15 by ragb on 2012-01-10 01:19 Regarding the versionnning schema, can't you change the snapshots versioning to comply with setuptools? It may provide mroe benefits later. With the repackaging code things will change in some ways so that could be an oportunity. Just an opinion though. So, shall I start coding something in this setuptools / eg ppackages path? |
Comment 16 by jteh (in reply to comment 15) on 2012-01-10 01:29
Any particular reason? I'm starting to think eggs are far more trouble than they're worth. We still have to mess about with modifying path on all packages unless we use entry points. Using entry points requires a lot of change which will either break backwards compatibility or make things confusing; e.g. different way of developing for internal versus add-ons.
This must take code running from source into account as well. Snapshot and source versions would end up being something like 2012.1a0.dev-bzr-main-4883, which is just hideous. It would probably change the output filename as well, which would require significant changes to the automatic build scripts. Branches other than main can be between releases (i.e. not yet 2012.2 but not 2012.1 either. Finally, 2012.1a0 is obviously considered to be before 2012.1, but this means that any add-ons for snapshots have to specify 2012.1a0, which is pretty ugly. I'm also not convinced that dependencies are even a good idea. This is going to become incredibly complicated, as users will then expect that dependencies download automatically, etc. This must be handled when a package is removed as well. |
Comment 17 by ragb (in reply to comment 16) on 2012-01-18 23:06
My rational is to got things more pythonic. Developpers used to python, setuptools, and easy_install might benefit from this kind of tools. However in the windows world things are not so straight-forward (I've been doing some python web development lately and in this case easy_install/distribute/... realy shine). NVDa itself is not packaed in that decoupled way, and honestly I don't think it would be worthwhile the effort to make it. yI believe ou have invested much time on the build infrastructure.
Yes. And changing to entry-points would break backwards compatibility. The current appmodules/brailleDisplayDrivers/... code must be kept arround. And the step curve for casual developers may be to high for casual developers (most appmodule developers are, so I believe).
Hmmm. Ok. Forgot that.
Many projects use that though... Sounds funy but not practical. And might confuse users used to current versioning schema. Snapshots are used by many people dispite beeing declared not stable. And user support nightmare would come...
HMM Ok. Got it. Confusing...:)
Ok. The main usecase is for stand-alone snapshots and may be bettter to stick to that for now. |
Comment 18 by ragb on 2012-01-18 23:27
What do yout think? |
Comment 19 by jteh on 2012-01-18 23:54 |
Comment 20 by ragb on 2012-01-29 15:08 |
Comment 21 by ragb on 2012-01-30 23:56 Here it is a preliminary specification of the manifest for an NVDA add-on. This only considers the add-on directory similar to what already exists on userconfig: pre-defined forlders and names for specific extensibility points.
This is a draft. I'm not considering compatibility with snapshots (how to do that?) nor explicit entry-points (something it is worth think about in my opinion) but as I said, this is just a prototype. Already implemented bundling of add-ons based on this manifest spec and I'm in the process of implementing extraction for userconfig/packages/ and patching NVDA to use code from those packages. Possible next steps may be, according to feedback:
|
Comment 22 by jteh on 2012-01-31 00:34 I'm also not sure there's really a need for a manifest of files. I'd think any files in the archive would just be extracted and the manager would handle tracking of installed files. |
Comment 23 by ragb (in reply to comment 22) on 2012-01-31 11:42
I understand your concerns about the localization issue, it surely requires additional work. ut eventualy we will have the need for a package index and users will ask for localization... If present in package metadata one can already use it for the NVDA interface and the index, keepping that information centralized. The first solution that comes to mind for this purpose is extending the metadata file with a localization section, like the folowing:
This requires the translator to edit the metadata file or provide it to the author. But gettext integration can be investigated, as it is already done in intltool-merge on Linux. I think the first solution is easier to everyone though. In the meantime I think that, for an initial phase we could have this localization issue open but try to come with something working first, without thinking too much about localization. Regarding the metadata itself (name, description, url...) I think it is really necessary so the user can get more information about the installed add-ons or some add-on he wants to install. Sadly most existing plugins that are hanging around are distributed on mailling-lists, twitter, drobox, etc. As we can not change that so easily at least plugin makers can provide some information without having users consult a website. This is just a rational. Compatible versions and such information must be provided somewhere though.
I'm not sure of any of the alternatives: bundle whatever tat is on the add-on directory or explicitly require the data to be bundled. Bundling everything creates the the situation where some less experienced people would bundle many stuff that is nod needed: hiden files, backup files (those ending with ~ or .swp), python source files (python bytecode alone works), gettext source translations, and so on. Not providing the source may be seen as bad, but add-on makers can delete .py files before zipping for the same purpose... Explicitly requiring metadata listing (python modules and packages ofcourse are implicit) puts more work on the hands of the add-on maker though. |
Attachment addons-213-1.diff added by ragb on 2012-02-07 21:43 |
Comment 24 by ragb on 2012-02-07 21:50 For now addons are read from ./addons or userConfig/addons. Directories with a manifest.ini file (spec defined on AddonManifest class) are considered valid and loaded. If the add contains the usual extension directories (brailleDisplayDrivers, appModules,...) those are add to the modules python path. The problem is that for testing must be created by hand.
In the mentioned addons directory create a sampleAddon directory and a manifest.ini file with those contents. Then put some plugin or something there to test. Note that this is not done, I'm submitting for early reviewing. |
Comment 25 by ragb on 2012-02-20 18:29 I' m slowly making progress on this. Some features I thinkk are good to implement:
I'm still developing on a local branch. I'm having issues with launchpad. Is it possible and easy for you to provide a branch on nvaccess servers? |
Comment 26 by jteh (in reply to comment 25) on 2012-02-20 20:56
These are all interesting ideas, but they are outside the scope of this ticket. They should all be addressed in separate tickets (and therefore separate branches).
Can you be more specific about the issues you're having with Launchpad? |
Comment 27 by ragb (in reply to comment 26) on 2012-02-20 21:50
Ok. Will create those when applicabe.
I can't commit to launchad under windows. It's something related with my ssh publi key, but I never understood the problem. I didn't create a nvda specific branch yet, but it happened on other projects. Under linux everything goes well. Will try again shortly. Btw, the lp:nvda branch on launchpad is not beeing mirrored since 2011-07-13. |
Comment 28 by jteh (in reply to comment 27) on 2012-02-20 21:57
You will probably have the same problem on whatever server you use. I'd suggest further debugging on this. I'm happy to help via nvda-dev if you can provide error messages and the like.
Damn. Thanks for reporting. I shall investigate. |
Comment 29 by ragb (in reply to comment 28) on 2012-02-21 00:09
Ok, problem solved. I lost my commit messages when merging (bzr seems to be a bit different from git) but have created a branch with my changes. Hopefully no more problems. Branch is on lp:~ruiandrebatista/nvda/addons-packaging |
Comment 40 by jteh (in reply to comment 39) on 2012-04-18 14:20
That's a good point. I can't see any reason we would ever initialise gui after plugins, though, so:
I agree. |
Comment 41 by jteh on 2012-04-19 08:43 |
Comment 42 by ragb (in reply to comment 41) on 2012-04-19 11:29
The code cleanups you sugested and some other corrections are done, I will commit them shortly. I think I can implement the gettext support you sugested this wikend. However, implementing something more complex like a GUI would take a bit more time, so I can not tell exactly when I have time to work on that. If you want to start on that path we could work in paralle, but I don't know if there something more to do before starting working on GUIs and stuff. regarding manifest translation, I was thinking about something. Supose we want to have some sort of add-on repository on the future. That repository could use manifest information directly to read add-on information. However, if we have translation scathered among many files that sort of processing would be harder. Anyway, this doesn't make things impossible by any means, just a bit more complex. Just a thought. |
Comment 43 by ragb (in reply to comment 42) on 2012-04-19 13:43
Pushed to lp:~ruiandrebatista/nvda/addons-packaging. revision 5025. Regards, Rui Batista |
Comment 44 by ragb (in reply to comment 42) on 2012-04-20 16:16 I coded a prototype for the translation support on lp:~ruiandrebatista/nvda.
This code may be a bit hackish please review... Inspection and such is something new for me so I might be doing things somehow wrong. |
Comment 45 by ragb on 2012-04-24 20:02 |
Comment 46 by mdcurran on 2012-04-30 05:39
Thoughts? |
Comment 47 by jteh (in reply to comment 46) on 2012-04-30 09:44
Consider changing this to ".pending". The reason is that people are less likely to use "." than "-" in add-on names, so we could reserve "." for special things like this.
I wonder whether isPending is a more accurate name here. |
Comment 48 by mdcurran on 2012-04-30 10:16 |
Comment 49 by jteh on 2012-04-30 10:22 |
Comment 50 by mdcurran on 2012-04-30 10:24 |
Comment 51 by jteh on 2012-04-30 10:27 |
Comment 52 by mdcurran on 2012-04-30 11:07 |
Comment 53 by ragb (in reply to comment 52) on 2012-04-30 11:56
This seems very good to me. The removals list avoids those problems you mention about path changing with code running and really simplifies the gui implementation. For me Did you saw my comment on the mailling list about using manifest translated data on the gui? |
Comment 54 by jteh (in reply to comment 53) on 2012-05-01 04:48
You wrote:
Can you explain what complications (if any) you hit when trying to do this? I imagined something like:
Btw, Mick did reply to your message on the list and suggested manifest.update(languageManifest). However, this would override all keys instead of just the localised ones, hence my suggestion above.
True, though I'm not sure whether this justifies the extra code, given the simplicity of the above solution (assuming i haven't missed something). Thoughts? Btw, there's probably no need to have a configSpec for the translated config, as it won't get used anyway unless you validate it and the values are all strings anyway. With regard to your !AddonManifest._ method, can you explain why the method takes a list of keys? I don't follow this, as it then only returns one value. |
Comment 55 by ragb (in reply to comment 54) on 2012-05-01 11:20
The complications I had were that I tried to write the code to be extensible for subsections. That is, if our manifest data had subsections to be translated. Anyway... ok, those are just dictionaries. If we don't write-back the manifest data there is no problem merging them.
I didn't read is message fo some reason... will recheck.
Yes, I will delete that.
It is to be extensible for subsections. Was thinking on adding an extra section to the manifest so wrote that that way, but I droped the idea because it wasn't making much sence, for now. So, as you pointed above explicitly copying some fields may be the best solution for now (if in the future we need more complex data to be translated we can merge the translated config and, if needed, validate it to make sure it as no extra-fields). Do you agree? |
Comment 56 by jteh on 2012-05-01 11:25 |
Comment 57 by ragb (in reply to comment 56) on 2012-05-01 11:28
Yes :). I'm now reading mike's commits. |
Comment 58 by jteh on 2012-05-02 04:37 Mick and i were discussing the possibility of having a separate installHooks (or installTasks) module. Separating it like this means you can document clearly that other modules in the add-on aren't yet usable. This way, there could be an install hook which is run after the add-on is extracted. If it fails, the extracted files would be immediately removed and the installation would fail. One problem is how to handle this for uninstallation. If an uninstall hook wants to remove or modify files, it can only do this as the add-on is being removed once NVDA restarts. If the uninstall hook wants to display some GUI, this means that the removal of add-ons has to be delayed until after the main loop has started. Rui, your thoughts would be greatly appreciated. :) |
Comment 59 by ragb (in reply to comment 58) on 2012-05-02 10:47
If we have an addon instance this means that the addon is extracted. So, if we have access to the hooks modules other modules can be imported, from there. Am I not seeing anything? :) probably yes :). Obviously no plugin nor braille display is running, but wx and such can be used. if the addon is to modify anything on installation one must have in mind that paths will change and such. But, as things are simply renamed, there should not be a big problem in most cases.
I have no problem with that but the hooks module already can contain one hook that runs before many things: the "load" hook. Honestly I only used it for debugging porposes but at the time this is called there isn't much stuff initialized in NVDA, I think. I'm happy to remove this hook if noone finds any utility for it, further then debugging. Maybe we should document the conditions when a hook is called. I thinkk that the "install" hook can be on hooks.py without much trouble, but if you think that installTass.py or something would be more explicit I'm also happy with that.
Yes. I don't see any other solution either then delaying it... But it's not that beautiful though. Another issue is wat to do if uninstallation throws any error or something. Remove the addon in any case?
I didn't have time to thing that much about this, but here they are... |
Comment 60 by jteh on 2012-05-07 23:06 |
Comment 61 by jteh on 2012-05-08 00:36 |
Comment 62 by jteh on 2012-05-08 08:57 Many thanks to Rui for all of his work on this. |
Reported by aleksey_s on 2008-10-27 14:38
as nvda goes much power many optional components might be added. for now we have only brltty and the newfon synth, further anything which will comes on. so i think we need to make some exact way for users to manage nvda components. it might be implemented with help of nsis or a standalone program. from user's side this will be a list of optional components which he can install or remove. currently, these might be followed components:
from developers side, it must be easy manageable list of packages. so, one database accessible from the website with some fields and packages theirselves. based on program with which to implement this feature, packages might to be in different formats. i don't know nsis features, but it may be script to run for optain package. it might just download and run executable (sapi runtime installation), or download, unzip and copy some files into nvda folder. each package might have different license agreement, which user must to accept.
The text was updated successfully, but these errors were encountered: