File: install.py

package info (click to toggle)
childsplay-alphabet-sounds-nb 0.9.1-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 600 kB
  • sloc: makefile: 34; python: 30
file content (61 lines) | stat: -rw-r--r-- 2,067 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# -*- coding: utf-8 -*-

# Copyright (c) 2007-2008 Stas Zykiewicz <stas.zytkiewicz@gmail.com>
#
#           install.py
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License
# as published by the Free Software Foundation.  A copy of this license should
# be included in the file GPL-3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

## used to install alphabeth sounds in the proper schoolsplay location 

import sys,os,shutil

#------ check for schoolsplay or childsplay_sp
try:
    from childsplay_sp import SPConstants
    from childsplay_sp.utils import import_module
except ImportError,info:
    print info
    print "Failled to locate childsplay_sp, check your installation"
    print "Exit..."
    sys.exit(1)

# construct paths
lang = import_module('version.py').LANGUAGE
destdir = os.path.join(SPConstants.ALPHABETDIR,lang)

# Start installing
if os.path.exists(destdir):
    print "Found an old alphabet directory: %s, removing it..." % destdir,
    shutil.rmtree(destdir)
    print " done"
print "Install module in %s..." % destdir,
shutil.copytree(os.path.join('AlphabetSounds',lang),destdir)
print " done"

# install flashcard soundfiles is we have any
if not os.path.exists("FlashCardsSounds"):
    print "Instalation finished"
    sys.exit(0)

destdir = os.path.join(SPConstants.ACTIVITYDATADIR,"CPData","FlashcardsData", "names", lang)
if os.path.exists(destdir):
    shutil.rmtree(destdir)

print "install flashcardsounds in %s..." % destdir, 
shutil.copytree(os.path.join('FlashCardSounds', lang),destdir)

print "done"
print "Instalation finished"