~openshot.code/openshot/main

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Jonathan Thomas
  • Date: 2009-09-08 04:49:08 UTC
  • Revision ID: jonathan@jonathan64-20090908044908-kzhw2m1dl251yt9y
Bumping version to 0.9.30

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.

The biggest changes: 
------------------------------
1) Distutils is now used to install OpenShot (setup.py install).
   Installing OpenShot this way will copy Mime Types, Register Icons,
   Add launcher to Application menu, and copy the OpenShot .py code 
   to the /site-packages/ folder.
2) Python code moved into ~/openshot/openshot/
3) New folders ~/openshot/[bin,docs,xdg]
4) Translations moved to ~/openshot/openshot/locale
5) classes/project.py contains all of the PATH variables
6) classes/info.py contains the version of OpenShot
7) after installing (using setup.py), the /openshot/bin/openshot 
   is the launcher that gets copied to the /usr/bin
8) A few bug fixes have also been added:
   A) removing marker clears timeline
   B) opening a project stopped some changes from refreshing the video
9) Arguments can be passed to OpenShot ($ openshot 'video1.avi', 'video2.avi')
------------------------------

There are now 2 ways to launch OpenShot.

$ openshot (assuming setup.py was used to install OpenShot)
$ ~/openshot/openshot/openshot.py  (I know... it looks funny)

Good luck to everyone testing this!  =)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
#       OpenShot Video Editor is a program that creates, modifies, and edits video files.
 
3
#
 
4
#       This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
 
5
#   Copyright (C) 2009  TJ, Jonathan Thomas
 
6
#
 
7
#       OpenShot Video Editor is free software: you can redistribute it and/or modify
 
8
#       it under the terms of the GNU General Public License as published by
 
9
#       the Free Software Foundation, either version 3 of the License, or
 
10
#       (at your option) any later version.
 
11
#
 
12
#       OpenShot Video Editor is distributed in the hope that it will be useful,
 
13
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
 
15
#       GNU General Public License for more details.
 
16
#
 
17
#       You should have received a copy of the GNU General Public License
 
18
#       along with OpenShot Video Editor.       If not, see <http://www.gnu.org/licenses/>.
 
19
 
 
20
import glob, os, sys, subprocess
 
21
from distutils.core import setup
 
22
 
 
23
print "Execution path: %s" % os.path.abspath(__file__)
 
24
from openshot.classes import info
 
25
 
 
26
# Boolean: running as root?
 
27
ROOT = os.geteuid() == 0
 
28
# For Debian packaging it could be a fakeroot so reset flag to prevent execution of
 
29
# system update services for Mime and Desktop registrations.
 
30
# The debian/openshot.postinst script must do those.
 
31
if not os.getenv("FAKEROOTKEY") == None:
 
32
        print "NOTICE: Detected execution in a FakeRoot so disabling calls to system update services."
 
33
        ROOT = False
 
34
 
 
35
os_files = [
 
36
         # XDG application description
 
37
         ('share/applications', ['xdg/openshot.desktop']),
 
38
         # XDG application icon
 
39
         ('share/pixmaps', ['xdg/openshot.png']),
 
40
         # XDG desktop mime types cache
 
41
         ('share/mime/packages',['xdg/openshot.xml']),
 
42
         # launcher (mime.types)
 
43
         ('lib/mime/packages',['xdg/openshot']),
 
44
         # man-page ("man 1 openshot")
 
45
         ('share/man/man1',['docs/openshot.1']),
 
46
]
 
47
 
 
48
# Call the main Distutils setup command
 
49
dist = setup(
 
50
 scripts        = ['bin/openshot'],
 
51
 packages        = ['openshot', 'openshot.classes', 'openshot.language', 'openshot.windows'],
 
52
 package_data = {
 
53
                                'openshot' : ['images/*', 'locale/OpenShot/*', 'locale/README', 'profiles/*', 'themes/blue_glass1/*', 'titles/*', 'transitions/*'],
 
54
                                'openshot.windows' : ['glade/*.glade', 'glade/icons/*'],
 
55
                                },
 
56
 data_files = os_files,
 
57
 **info.SETUP
 
58
)
 
59
 
 
60
 
 
61
FAILED = 'Failed to update.\n'
 
62
 
 
63
if ROOT and dist != None:
 
64
        #update the XDG Shared MIME-Info database cache
 
65
        try: 
 
66
                sys.stdout.write('Updating the Shared MIME-Info database cache.\n')
 
67
                subprocess.call(["update-mime-database", os.path.join(sys.prefix, "share/mime/")])
 
68
        except:
 
69
                sys.stderr.write(FAILED)
 
70
 
 
71
        #update the mime.types database
 
72
        try: 
 
73
                sys.stdout.write('Updating the mime.types database\n')
 
74
                subprocess.call("update-mime")
 
75
        except:
 
76
                sys.stderr.write(FAILED)
 
77
 
 
78
        # update the XDG .desktop file database
 
79
        try:
 
80
                sys.stdout.write('Updating the .desktop file database.\n')
 
81
                subprocess.call(["update-desktop-database"])
 
82
        except:
 
83
                sys.stderr.write(FAILED)
 
84
        sys.stdout.write("\n-----------------------------------------------")
 
85
        sys.stdout.write("\nInstallation Finished!")
 
86
        sys.stdout.write("\nRun OpenShot by typing 'openshot' or through the Applications menu.")
 
87
        sys.stdout.write("\n-----------------------------------------------\n")