← Back to team overview

openshot.developers team mailing list archive

Re: New Version: 0.9.31

 

On Tue, 2009-09-08 at 00:46 -0500, Jonathan Thomas wrote:
> Here it goes. Massive re-factoring across OpenShot. I put a ton of
> regression work into this to ensure everything still works, but as
> always, I could have missed something.  TJ's branch and Andy's branch
> have been merged into the trunk... along with many other changes and
> bug fixes.

It looks pretty good so far. I've noticed a few relatively minor issues
which I'll address.

> The biggest changes:
> ------------------------------
> 2) Python code moved into ~/openshot/openshot/
> 3) New folders ~/openshot/[bin,docs,xdg]
> 4) Translations moved to ~/openshot/openshot/locale

You've lost me here! These paths are in the user's home directory. Are
you meaning the source-code file locations? If so I'd suggest using
relative-path nomenclature to avoid confusion (./openshot/...).

I noticed that "locale/" is now being installed inside the application
directory but the package_data glob is installing the language source
files. This is incorrect - it should only install the compiled
openshot.mo files.

distutils package_data globs can't capture sub-directories automatically
('locale/*/LC_MESSAGES/*.mo') which is why I used custom code to
generate the list of "*.mo" files and their paths.
I think you should be able to do the same thing and tack the list onto
the end of package_data rather than data_files.

This would also nicely avoid the need to remember to add
'locale/<language>/LC_MESSAGES/*.mo' to package_data every time a new
language is added.

A distro package installer will then move all those files to the
"/usr/share/locales/<language>/LC_MESSAGES/openshot.mo" locations.

This also brings me on to another issue - the language files themselves.

It would make a great deal of sense to include the templates for every
supported language in the source repository and in addition re-compile
the "mo" files when-ever a revised translation is added, so that the
repository always contains the up-to-date compiled translations.

This is different from how compiled binary packages work. In those, the
language files are built at the same time as the binaries by the
Makefile.

There's no reason to keep the translations separate and it makes
managing them much more difficult. It would make packaging so much
easier and end-user's wouldn't need to install anything else to take
advantage of multi-language support.

I've modified the Debian packaging to work with the revised locations
and I'll commit it to the packaging branch ready to publish a test
package once the following issue has been fixed in the trunk.

After installation the launcher throws up an error:

Error:  OpenShot has not been installed in the Python path.
Use the following command to install OpenShot:
  $ sudo python setup.py install

This is because you've moved the installation location of
"bin/openshot" (to "usr/bin/") rather than the location it expects (the
base openshot application directory) but not modified the code to deal
with the different location, so

from openshot.openshot

fails since openshot is installed by python-support and isn't in the
"{site,dist}-packages/" directories.

I've reworked "bin/openshot" to cope with this. Right now it doesn't use
any intelligence to figure out where the application is installed, it
just assumes the LFH standard "/usr/share/openshot/" but we could modify
that in the future if necessary.

=== modified file 'bin/openshot'
--- bin/openshot	2009-09-08 04:49:08 +0000
+++ bin/openshot	2009-09-08 08:53:00 +0000
@@ -21,17 +21,28 @@
 import sys, os
 
 # dereference symbolic links used to start the application
-if os.path.islink(__file__):
-	realfile = os.path.realpath(__file__)
+realfile = os.path.realpath(__file__)
+
+# ensure the openshot module directory is in the system path so relative 'import' statements work
+
+# determine if openshot is installed at this location
+realfile_dir = os.path.dirname(os.path.abspath(realfile))
+print "realfile_dir=%s" % realfile_dir
+if os.path.exists(os.path.join(realfile_dir, 'openshot.py')):
+	sys.path.insert(0, realfile_dir)
+	print "Added %s to system path" % realfile_dir
 else:
-	realfile = __file__
-
-# ensure the openshot module directory is in the system path so relative 'import' statements work
-sys.path.insert(0, os.path.dirname(os.path.abspath(realfile)))
+	# launcher has been separated from the application so need to guess where to find it
+	# Possibly the distribution package-installer uses an indirect method to install
+	# the application (such as python-support on Debian).
+	# Try to deduce the correct location and try again
+	realfile_dir = '/usr/share/openshot'
+	sys.path.insert(0, realfile_dir);
+	print "Added %s to system path" % realfile_dir
 
 # import OpenShot code and run the program
 try:
-	from openshot.openshot import main
+	from openshot import main
 	main()
 	
 except ImportError:





Follow ups

References