aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/.gitignore2
-rw-r--r--lib/python/Components/Harddisk.py140
-rwxr-xr-xlib/python/Components/Keyboard.py7
-rw-r--r--lib/python/Components/NimManager.py4
-rw-r--r--lib/python/Components/Renderer/Picon.py4
-rw-r--r--lib/python/Components/UsageConfig.py4
-rw-r--r--lib/python/Makefile.am38
-rw-r--r--lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am2
-rw-r--r--lib/python/Plugins/Extensions/DVDPlayer/Makefile.am2
-rw-r--r--lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am24
-rwxr-xr-xlib/python/Plugins/Extensions/Makefile.am6
-rw-r--r--lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am24
-rwxr-xr-xlib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py6
-rw-r--r--lib/python/Plugins/SystemPlugins/Hotplug/plugin.py326
-rwxr-xr-xlib/python/Plugins/SystemPlugins/NFIFlash/flasher.py6
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SkinSelector/plugin.py3
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py4
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py3
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py6
-rwxr-xr-xlib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am4
-rwxr-xr-xlib/python/Plugins/SystemPlugins/WirelessLan/plugin.py4
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/newplugin.py2
-rw-r--r--lib/python/Screens/ChannelSelection.py4
-rwxr-xr-xlib/python/Screens/Setup.py3
-rwxr-xr-xlib/python/Screens/Wizard.py4
-rwxr-xr-xlib/python/Tools/Directories.py27
-rw-r--r--lib/python/connections.h5
-rw-r--r--lib/python/enigma_python.i6
-rw-r--r--lib/python/python.h1
29 files changed, 482 insertions, 189 deletions
diff --git a/lib/python/.gitignore b/lib/python/.gitignore
new file mode 100644
index 00000000..c1fa59fc
--- /dev/null
+++ b/lib/python/.gitignore
@@ -0,0 +1,2 @@
+enigma.py
+enigma_python.cpp
diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py
index 7f837565..0f1a8fca 100644
--- a/lib/python/Components/Harddisk.py
+++ b/lib/python/Components/Harddisk.py
@@ -15,17 +15,17 @@ def readFile(filename):
file.close()
return data
-class Harddisk:
- DEVTYPE_UDEV = 0
- DEVTYPE_DEVFS = 1
+DEVTYPE_UDEV = 0
+DEVTYPE_DEVFS = 1
+class Harddisk:
def __init__(self, device):
self.device = device
if access("/dev/.udev", 0):
- self.type = self.DEVTYPE_UDEV
+ self.type = DEVTYPE_UDEV
elif access("/dev/.devfsd", 0):
- self.type = self.DEVTYPE_DEVFS
+ self.type = DEVTYPE_DEVFS
else:
print "Unable to determine structure of /dev"
@@ -37,11 +37,11 @@ class Harddisk:
self.disk_path = ''
self.phys_path = path.realpath(self.sysfsPath('device'))
- if self.type == self.DEVTYPE_UDEV:
+ if self.type == DEVTYPE_UDEV:
self.dev_path = '/dev/' + self.device
self.disk_path = self.dev_path
- elif self.type == self.DEVTYPE_DEVFS:
+ elif self.type == DEVTYPE_DEVFS:
tmp = readFile(self.sysfsPath('dev')).split(':')
s_major = int(tmp[0])
s_minor = int(tmp[1])
@@ -64,9 +64,9 @@ class Harddisk:
return self.device < ob.device
def partitionPath(self, n):
- if self.type == self.DEVTYPE_UDEV:
+ if self.type == DEVTYPE_UDEV:
return self.dev_path + n
- elif self.type == self.DEVTYPE_DEVFS:
+ elif self.type == DEVTYPE_DEVFS:
return self.dev_path + '/part' + n
def sysfsPath(self, filename):
@@ -79,9 +79,9 @@ class Harddisk:
def bus(self):
# CF (7025 specific)
- if self.type == self.DEVTYPE_UDEV:
+ if self.type == DEVTYPE_UDEV:
ide_cf = False # FIXME
- elif self.type == self.DEVTYPE_DEVFS:
+ elif self.type == DEVTYPE_DEVFS:
ide_cf = self.device[:2] == "hd" and "host0" not in self.dev_path
internal = "pci" in self.phys_path
@@ -142,7 +142,7 @@ class Harddisk:
def numPartitions(self):
numPart = -1
- if self.type == self.DEVTYPE_UDEV:
+ if self.type == DEVTYPE_UDEV:
try:
devdir = listdir('/dev')
except OSError:
@@ -151,7 +151,7 @@ class Harddisk:
if filename.startswith(self.device):
numPart += 1
- elif self.type == self.DEVTYPE_DEVFS:
+ elif self.type == DEVTYPE_DEVFS:
try:
idedir = listdir(self.dev_path)
except OSError:
@@ -413,24 +413,38 @@ class Partition:
return True
return False
-DEVICEDB = \
+DEVICEDB_SR = \
{"dm8000":
{
- # dm8000:
- "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.1/1-1.1:1.0": "Front USB Slot",
- "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.2/1-1.2:1.0": "Back, upper USB Slot",
- "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.3/1-1.3:1.0": "Back, lower USB Slot",
- "/devices/platform/brcm-ehci-1.1/usb2/2-1/2-1:1.0/host1/target1:0:0/1:0:0:0": "DVD Drive",
+ "/devices/pci0000:01/0000:01:00.0/host0/target0:0:0/0:0:0:0": _("DVD Drive"),
+ "/devices/pci0000:01/0000:01:00.0/host1/target1:0:0/1:0:0:0": _("DVD Drive"),
+ "/devices/platform/brcm-ehci-1.1/usb2/2-1/2-1:1.0/host3/target3:0:0/3:0:0:0": _("DVD Drive"),
+ },
+ "dm800":
+ {
+ },
+ "dm7025":
+ {
+ }
+ }
+
+DEVICEDB = \
+ {"dm8000":
+ {
+ "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.1/1-1.1:1.0": _("Front USB Slot"),
+ "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.2/1-1.2:1.0": _("Back, upper USB Slot"),
+ "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.3/1-1.3:1.0": _("Back, lower USB Slot"),
+ "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.1/1-1.1:1.0": _("Front USB Slot"),
+ "/devices/platform/brcm-ehci-1.1/usb2/2-1/2-1:1.0/": _("Internal USB Slot"),
+ "/devices/platform/brcm-ohci-1.1/usb4/4-1/4-1:1.0/": _("Internal USB Slot"),
},
"dm800":
{
- # dm800:
"/devices/platform/brcm-ehci.0/usb1/1-2/1-2:1.0": "Upper USB Slot",
"/devices/platform/brcm-ehci.0/usb1/1-1/1-1:1.0": "Lower USB Slot",
},
"dm7025":
{
- # dm7025:
"/devices/pci0000:00/0000:00:14.1/ide1/1.0": "CF Card Slot", #hdc
"/devices/pci0000:00/0000:00:14.1/ide0/0.0": "Internal Harddisk"
}
@@ -441,6 +455,7 @@ class HarddiskManager:
self.hdd = [ ]
self.cd = ""
self.partitions = [ ]
+ self.devices_scanned_on_init = [ ]
self.on_partition_list_change = CList()
@@ -508,24 +523,23 @@ class HarddiskManager:
def enumerateBlockDevices(self):
print "enumerating block devices..."
for blockdev in listdir("/sys/block"):
- error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(blockdev)
- print "found block device '%s':" % blockdev,
- if error:
- print "error querying properties"
- elif blacklisted:
- print "blacklisted"
- elif not medium_found:
- print "no medium"
- else:
- print "ok, removable=%s, cdrom=%s, partitions=%s, device=%s" % (removable, is_cdrom, partitions, blockdev)
-
- self.addHotplugPartition(blockdev)
- for part in partitions:
- self.addHotplugPartition(part)
+ error, blacklisted, removable, is_cdrom, partitions, medium_found = self.addHotplugPartition(blockdev)
+ if not error and not blacklisted:
+ if medium_found:
+ for part in partitions:
+ self.addHotplugPartition(part)
+ self.devices_scanned_on_init.append((blockdev, removable, is_cdrom, medium_found))
def getAutofsMountpoint(self, device):
return "/autofs/%s/" % (device)
+ def is_hard_mounted(self, device):
+ mounts = file('/proc/mounts').read().split('\n')
+ for x in mounts:
+ if x.find('/autofs') == -1 and x.find(device) != -1:
+ return True
+ return False
+
def addHotplugPartition(self, device, physdev = None):
if not physdev:
dev, part = self.splitDeviceName(device)
@@ -535,22 +549,36 @@ class HarddiskManager:
physdev = dev
print "couldn't determine blockdev physdev for device", device
- # device is the device name, without /dev
- # physdev is the physical device path, which we (might) use to determine the userfriendly name
- description = self.getUserfriendlyDeviceName(device, physdev)
+ error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(device)
+ print "found block device '%s':" % device,
- p = Partition(mountpoint = self.getAutofsMountpoint(device), description = description, force_mounted = True, device = device)
- self.partitions.append(p)
- self.on_partition_list_change("add", p)
+ if blacklisted:
+ print "blacklisted"
+ else:
+ if error:
+ print "error querying properties"
+ elif not medium_found:
+ print "no medium"
+ else:
+ print "ok, removable=%s, cdrom=%s, partitions=%s" % (removable, is_cdrom, partitions)
+
+ l = len(device)
+ if l:
+ # see if this is a harddrive
+ if not device[l-1].isdigit() and not removable and not is_cdrom:
+ self.hdd.append(Harddisk(device))
+ self.hdd.sort()
+ SystemInfo["Harddisk"] = len(self.hdd) > 0
+
+ if (not removable or medium_found) and not self.is_hard_mounted(device):
+ # device is the device name, without /dev
+ # physdev is the physical device path, which we (might) use to determine the userfriendly name
+ description = self.getUserfriendlyDeviceName(device, physdev)
+ p = Partition(mountpoint = self.getAutofsMountpoint(device), description = description, force_mounted = True, device = device)
+ self.partitions.append(p)
+ self.on_partition_list_change("add", p)
- # see if this is a harddrive
- l = len(device)
- if l and not device[l-1].isdigit():
- error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(device)
- if not blacklisted and not removable and not is_cdrom and medium_found:
- self.hdd.append(Harddisk(device))
- self.hdd.sort()
- SystemInfo["Harddisk"] = len(self.hdd) > 0
+ return error, blacklisted, removable, is_cdrom, partitions, medium_found
def removeHotplugPartition(self, device):
mountpoint = self.getAutofsMountpoint(device)
@@ -608,15 +636,23 @@ class HarddiskManager:
def getUserfriendlyDeviceName(self, dev, phys):
dev, part = self.splitDeviceName(dev)
description = "External Storage %s" % dev
+ have_model_descr = False
try:
description = readFile("/sys" + phys + "/model")
+ have_model_descr = True
except IOError, s:
print "couldn't read model: ", s
from Tools.HardwareInfo import HardwareInfo
- for physdevprefix, pdescription in DEVICEDB.get(HardwareInfo().device_name,{}).items():
+ if dev.find('sr') == 0 and dev[2].isdigit():
+ devicedb = DEVICEDB_SR
+ else:
+ devicedb = DEVICEDB
+ for physdevprefix, pdescription in devicedb.get(HardwareInfo().device_name,{}).items():
if phys.startswith(physdevprefix):
- description = pdescription
-
+ if have_model_descr:
+ description = pdescription + ' - ' + description
+ else:
+ description = pdescription
# not wholedisk and not partition 1
if part and part != 1:
description += " (Partition %d)" % part
diff --git a/lib/python/Components/Keyboard.py b/lib/python/Components/Keyboard.py
index 820d1036..b026cd56 100755
--- a/lib/python/Components/Keyboard.py
+++ b/lib/python/Components/Keyboard.py
@@ -1,6 +1,7 @@
from Components.Console import Console
from os import listdir as os_listdir, path as os_path
from re import compile as re_compile
+from enigma import eEnv
class Keyboard:
def __init__(self):
@@ -8,9 +9,9 @@ class Keyboard:
self.readKeyboardMapFiles()
def readKeyboardMapFiles(self):
- for keymapfile in os_listdir('/usr/share/keymaps/'):
+ for keymapfile in os_listdir(eEnv.resolve('${datadir}/keymaps/')):
if (keymapfile.endswith(".info")):
- f = open('/usr/share/keymaps/' + keymapfile)
+ f = open(eEnv.resolve('${datadir}/keymaps/') + keymapfile)
mapfile = None
mapname = None
for line in f:
@@ -32,7 +33,7 @@ class Keyboard:
try:
keymap = self.keyboardmaps[index]
print "Activating keymap:",keymap[1]
- keymappath = '/usr/share/keymaps/' + keymap[0]
+ keymappath = eEnv.resolve('${datadir}/keymaps/') + keymap[0]
if os_path.exists(keymappath):
Console().ePopen(("loadkmap < " + str(keymappath)))
except:
diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py
index 73031861..d8a7c5c2 100644
--- a/lib/python/Components/NimManager.py
+++ b/lib/python/Components/NimManager.py
@@ -10,7 +10,7 @@ from enigma import eDVBSatelliteEquipmentControl as secClass, \
eDVBSatelliteDiseqcParameters as diseqcParam, \
eDVBSatelliteSwitchParameters as switchParam, \
eDVBSatelliteRotorParameters as rotorParam, \
- eDVBResourceManager, eDVBDB
+ eDVBResourceManager, eDVBDB, eEnv
from time import localtime, mktime
from datetime import datetime
@@ -1082,7 +1082,7 @@ def InitNimManager(nimmgr):
unicablelnbproducts = {}
unicablematrixproducts = {}
- doc = xml.etree.cElementTree.parse("/usr/share/enigma2/unicable.xml")
+ doc = xml.etree.cElementTree.parse(eEnv.resolve("${datadir}/enigma2/unicable.xml"))
root = doc.getroot()
entry = root.find("lnb")
diff --git a/lib/python/Components/Renderer/Picon.py b/lib/python/Components/Renderer/Picon.py
index 5ae43ed8..51dc09a5 100644
--- a/lib/python/Components/Renderer/Picon.py
+++ b/lib/python/Components/Renderer/Picon.py
@@ -2,11 +2,11 @@
## Picon renderer by Gruffy .. some speedups by Ghost
##
from Renderer import Renderer
-from enigma import ePixmap
+from enigma import ePixmap, eEnv
from Tools.Directories import fileExists, SCOPE_SKIN_IMAGE, SCOPE_CURRENT_SKIN, resolveFilename
class Picon(Renderer):
- searchPaths = ('/usr/share/enigma2/%s/',
+ searchPaths = (eEnv.resolve('${datadir}/enigma2/%s/'),
'/media/cf/%s/',
'/media/usb/%s/')
diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py
index b86c1a13..8ea9aa6a 100644
--- a/lib/python/Components/UsageConfig.py
+++ b/lib/python/Components/UsageConfig.py
@@ -1,7 +1,7 @@
from Components.Harddisk import harddiskmanager
from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigNumber, ConfigSet, ConfigLocations
from Tools.Directories import resolveFilename, SCOPE_HDD
-from enigma import Misc_Options, setTunerTypePriorityOrder;
+from enigma import Misc_Options, setTunerTypePriorityOrder, eEnv;
from SystemInfo import SystemInfo
import os
@@ -94,7 +94,7 @@ def InitUsageConfig():
SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
- config.usage.keymap = ConfigText(default = "/usr/share/enigma2/keymap.xml")
+ config.usage.keymap = ConfigText(default = eEnv.resolve("${datadir}/enigma2/keymap.xml"))
config.seek = ConfigSubsection()
config.seek.selfdefined_13 = ConfigNumber(default=15)
diff --git a/lib/python/Makefile.am b/lib/python/Makefile.am
index e38f7d82..666ba67d 100644
--- a/lib/python/Makefile.am
+++ b/lib/python/Makefile.am
@@ -1,23 +1,45 @@
-INCLUDES = \
+AM_CPPFLAGS = \
+ -I$(top_srcdir) \
-I$(top_srcdir)/include \
- -I$(top_srcdir)/src
+ -include Python.h \
+ -include $(top_builddir)/enigma2_config.h
SUBDIRS = Components Tools Screens Plugins
noinst_LIBRARIES = libenigma_python.a
libenigma_python_a_SOURCES = \
- python.cpp enigma_python_wrap.cxx connections.cpp
+ connections.cpp \
+ python.cpp
-enigma_python_wrap.cxx: enigma_python.i
- swig -I$(top_srcdir)/ -c++ -python -O -nortti -nothreads enigma_python.i
- python enigma_py_patcher.py
+pythonincludedir = $(pkgincludedir)/lib/python
+pythoninclude_HEADERS = \
+ connections.h \
+ python.h \
+ swig.h
-enigma.py: enigma_python_wrap.cxx
+nodist_libenigma_python_a_SOURCES = \
+ enigma_python.cpp
-CLEANFILES = enigma.py enigma_python_wrap.cxx
+noinst_PYTHON = \
+ enigma_py_patcher.py
+
+EXTRA_DIST = \
+ enigma_python.i
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enigma_python.Pcpp@am__quote@
+
+.i.cpp:
+ $(AM_V_GEN)$(SWIG) $(AX_SWIG_PYTHON_OPT) -MT $@ -MD -MF $(DEPDIR)/$*.Tpo -I$(top_srcdir) -O -nortti -nothreads -o $@ $<
+ $(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Pcpp
+ $(AM_V_at)$(PYTHON) $(srcdir)/enigma_py_patcher.py
+
+enigma.py: enigma_python.cpp
+
+CLEANFILES = enigma.py enigma_python.cpp
installdir = $(pkglibdir)/python
install_PYTHON = \
enigma.py
+
diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am b/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am
index 3ccca98e..4828081f 100644
--- a/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am
+++ b/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am
@@ -1,4 +1,4 @@
-installdir = $(LIBDIR)/enigma2/python/Plugins/DemoPlugins/TPMDemo
+installdir = $(pkglibdir)/python/Plugins/DemoPlugins/TPMDemo
install_PYTHON = \
__init__.py \
diff --git a/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am b/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am
index 71ea7142..ec212e47 100644
--- a/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am
+++ b/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am
@@ -1,4 +1,3 @@
-if HAVE_DDVDLIB
SUBDIRS = src meta
installdir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer
@@ -8,4 +7,3 @@ install_PYTHON = \
plugin.py \
keymap.xml \
LICENSE
-endif
diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am b/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am
index 27c751cf..7aaec9bb 100644
--- a/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am
+++ b/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am
@@ -1,17 +1,15 @@
-OBJS := servicedvd.cpp
+AM_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/include \
+ -include Python.h \
+ -include $(top_builddir)/enigma2_config.h
--include $(OBJS:.cpp=.d)
+plugindir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer
-installdir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer
+plugin_LTLIBRARIES = servicedvd.la
-install_PYTHON = \
- servicedvd.so
+servicedvd_la_SOURCES = \
+ servicedvd.cpp \
+ servicedvd.h
-servicedvd.so:
- $(CXX) $(CPPFLAGS) -MD $(CXXFLAGS) $(DEFS) -I$(top_srcdir)/include \
- -Wall -W $(OBJS) -shared -fPIC -Wl,-soname,servicedvd.so -o servicedvd.so \
- $(LDFLAGS) -ldreamdvd
-
-all: servicedvd.so
-
-CLEANFILES = servicedvd.so servicedvd.d
+servicedvd_la_LDFLAGS = -avoid-version -module
diff --git a/lib/python/Plugins/Extensions/Makefile.am b/lib/python/Plugins/Extensions/Makefile.am
index 5a6e3f3a..7a3a9be2 100755
--- a/lib/python/Plugins/Extensions/Makefile.am
+++ b/lib/python/Plugins/Extensions/Makefile.am
@@ -1,6 +1,10 @@
installdir = $(pkglibdir)/python/Plugins/Extensions
-SUBDIRS = TuxboxPlugins CutListEditor PicturePlayer MediaScanner MediaPlayer GraphMultiEPG SocketMMI DVDPlayer DVDBurn Modem
+SUBDIRS = TuxboxPlugins CutListEditor PicturePlayer MediaScanner MediaPlayer GraphMultiEPG SocketMMI DVDBurn Modem
+
+if HAVE_LIBDDVD
+SUBDIRS += DVDPlayer
+endif
install_PYTHON = \
__init__.py
diff --git a/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am b/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am
index 8e80e183..5ce7d031 100644
--- a/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am
+++ b/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am
@@ -1,17 +1,15 @@
-OBJS = socket_mmi.cpp
+AM_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/include \
+ -include Python.h \
+ -include $(top_builddir)/enigma2_config.h
--include $(OBJS:.cpp=.d)
+plugindir = $(pkglibdir)/python/Plugins/Extensions/SocketMMI
-installdir = $(pkglibdir)/python/Plugins/Extensions/SocketMMI
+plugin_LTLIBRARIES = socketmmi.la
-install_PYTHON = \
- socketmmi.so
+socketmmi_la_SOURCES = \
+ socket_mmi.cpp \
+ socket_mmi.h
-socketmmi.so: socket_mmi.cpp socket_mmi.h
- $(CXX) $(CPPFLAGS) -MD $(CXXFLAGS) $(DEFS) -I$(top_srcdir)/include \
- -Wall -W $(OBJS) -shared -fPIC -Wl,-soname,socketmmi.so -o socketmmi.so \
- $(LDFLAGS)
-
-all: socketmmi.so
-
-CLEANFILES = socketmmi.so socketmmi.d
+socketmmi_la_LDFLAGS = -avoid-version -module
diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py
index 2c0edf53..52296c66 100755
--- a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py
@@ -12,7 +12,7 @@ from ServiceReference import ServiceReference
from Plugins.Plugin import PluginDescriptor
from xml.etree.cElementTree import parse as ci_parse
from Tools.XMLTools import elementsWithTag, mergeText, stringToXML
-from enigma import eDVBCI_UI, eDVBCIInterfaces
+from enigma import eDVBCI_UI, eDVBCIInterfaces, eEnv
from os import system, path as os_path
@@ -115,7 +115,7 @@ class CIconfigMenu(Screen):
Screen.__init__(self, session)
self.ci_slot=ci_slot
- self.filename="/etc/enigma2/ci"+str(self.ci_slot)+".xml"
+ self.filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(self.ci_slot) + ".xml"
self["key_red"] = StaticText(_("Delete"))
self["key_green"] = StaticText(_("add Service"))
@@ -567,7 +567,7 @@ def activate_all(session):
return Len > 0 and definitions[Len-1].text or default
for ci in range(NUM_CI):
- filename="/etc/enigma2/ci"+str(ci)+".xml"
+ filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(ci) + ".xml"
if not os_path.exists(filename):
print "[CI_Activate_Config_CI%d] no config file found" %ci
diff --git a/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py b/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py
index b19007c9..1f379f10 100644
--- a/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py
@@ -1,66 +1,300 @@
from Plugins.Plugin import PluginDescriptor
-from twisted.internet.protocol import Protocol, Factory
-from twisted.internet import reactor
from Components.Harddisk import harddiskmanager
+from Tools.Directories import fileExists
hotplugNotifier = [ ]
+bdpoll = None
-class Hotplug(Protocol):
- def connectionMade(self):
- self.received = ""
+def processHotplugData(self, v):
+ print "hotplug:", v
+ action = v.get("ACTION")
+ device = v.get("DEVPATH")
+ physdevpath = v.get("PHYSDEVPATH")
+ media_state = v.get("X_E2_MEDIA_STATUS")
- def dataReceived(self, data):
- self.received += data
+ dev = device.split('/')[-1]
- def connectionLost(self, reason):
- data = self.received.split('\0')[:-1]
+ if action is not None and action == "add":
+ error, blacklisted, removable, is_cdrom, partitions, medium_found = harddiskmanager.addHotplugPartition(dev, physdevpath)
+ if bdpoll and removable or is_cdrom:
+ bdpoll.addDevice(dev, is_cdrom, medium_found)
+ elif action is not None and action == "remove":
+ if bdpoll:
+ bdpoll.removeDevice(dev)
+ harddiskmanager.removeHotplugPartition(dev)
+ elif media_state is not None:
+ if media_state == '1':
+ harddiskmanager.removeHotplugPartition(dev)
+ harddiskmanager.addHotplugPartition(dev, physdevpath)
+ elif media_state == '0':
+ harddiskmanager.removeHotplugPartition(dev)
- v = {}
+ for callback in hotplugNotifier:
+ try:
+ callback(dev, action or media_state)
+ except AttributeError:
+ hotplugNotifier.remove(callback)
- for x in data:
- i = x.find('=')
- var, val = x[:i], x[i+1:]
- v[var] = val
+CDROM_DRIVE_STATUS = 0x5326
+CDROM_MEDIA_CHANGED = 0x5325
+CDSL_CURRENT = ((int)(~0>>1))
+CDS_NO_INFO = 0
+CDS_NO_DISC = 1
+CDS_TRAY_OPEN = 2
+CDS_DRIVE_NOT_READY = 3
+CDS_DISC_OK = 4
+ENOMEDIUM = 159
+IOC_NRBITS = 8
+IOC_NRSHIFT = 0
+IOC_TYPESHIFT = (IOC_NRSHIFT+IOC_NRBITS)
+BLKRRPART = ((0x12<<IOC_TYPESHIFT) | (95<<IOC_NRSHIFT))
- print "hotplug:", v
+def autostart(reason, **kwargs):
+ if reason == 0:
+ print "starting hotplug handler"
- action = v.get("ACTION")
- device = v.get("DEVPATH")
- physdevpath = v.get("PHYSDEVPATH")
- media_state = v.get("X_E2_MEDIA_STATUS")
+ if fileExists('/dev/.udev'):
+ global netlink
+ global bdpoll
+ from enigma import eSocketNotifier, eTimer, ePythonMessagePump
+ import socket
+ from select import POLLIN, POLLPRI
- dev = device.split('/')[-1]
+ class Netlink:
+ def __init__(self):
+ self.netlink = socket.socket(socket.AF_NETLINK, socket.SOCK_DGRAM, 15)
+ self.netlink.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 65536)
+ self.netlink.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 65536)
+ self.netlink.bind((0, 1))
+ self.sn = eSocketNotifier(self.netlink.fileno(), POLLIN|POLLPRI)
+ self.sn.callback.append(self.dataAvail)
- if action is not None and action == "add":
- harddiskmanager.addHotplugPartition(dev, physdevpath)
- elif action is not None and action == "remove":
- harddiskmanager.removeHotplugPartition(dev)
- elif media_state is not None:
- if media_state == '1':
- harddiskmanager.removeHotplugPartition(dev)
- harddiskmanager.addHotplugPartition(dev, physdevpath)
- elif media_state == '0':
- harddiskmanager.removeHotplugPartition(dev)
-
- for callback in hotplugNotifier:
- try:
- callback(dev, action or media_state)
- except AttributeError:
- hotplugNotifier.remove(callback)
+ def dataAvail(self, what):
+ received = self.netlink.recvfrom(16384)
+# print "HOTPLUG(%d):" %(what), received
-def autostart(reason, **kwargs):
- if reason == 0:
- print "starting hotplug handler"
- factory = Factory()
- factory.protocol = Hotplug
+ data = received[0].split('\0')[:-1]
+ v = {}
+
+ for x in data:
+ i = x.find('=')
+ var, val = x[:i], x[i+1:]
+ v[var] = val
+
+ if v['SUBSYSTEM'] == 'block' and v['ACTION'] in ('add', 'remove'):
+ processHotplugData(self, v)
+
+ from threading import Thread, Semaphore, Lock
+
+ class ThreadQueue:
+ def __init__(self):
+ self.__list = [ ]
+ self.__lock = Lock()
+
+ def push(self, val):
+ list = self.__list
+ lock = self.__lock
+ lock.acquire()
+ list.append(val)
+ lock.release()
+
+ def pop(self):
+ list = self.__list
+ lock = self.__lock
+ lock.acquire()
+ ret = list[0]
+ del list[0]
+ lock.release()
+ return ret
- try:
import os
- os.remove("/tmp/hotplug.socket")
- except OSError:
- pass
+ import errno
+ import fcntl
+
+ class BDPoll(Thread):
+ CHECK_INTERVAL = 2000
+ MSG_MEDIUM_REMOVED = 1
+ MSG_MEDIUM_INSERTED = 2
+ MSG_POLL_FINISHED = 4
+ def __init__(self):
+ Thread.__init__(self)
+ self.__sema = Semaphore(0)
+ self.__lock = Lock()
+ self.running = False
+ self.devices_to_poll = { }
+ self.messages = ThreadQueue()
+ self.checkTimer = eTimer()
+ self.checkTimer.callback.append(self.timeout)
+ self.checkTimer.start(BDPoll.CHECK_INTERVAL, True)
+ self.mp = ePythonMessagePump()
+ self.mp.recv_msg.get().append(self.gotThreadMsg)
+ self.start()
+
+ def gotThreadMsg(self, msg):
+ msg = self.messages.pop()
+ if msg[0] == BDPoll.MSG_MEDIUM_REMOVED:
+ print "MSG_MEDIUM_REMOVED"
+ harddiskmanager.removeHotplugPartition(msg[1])
+ elif msg[0] == BDPoll.MSG_MEDIUM_INSERTED:
+ print "MSG_MEDIUM_INSERTED"
+ harddiskmanager.addHotplugPartition(msg[1])
+ elif msg[0] == BDPoll.MSG_POLL_FINISHED:
+ self.checkTimer.start(BDPoll.CHECK_INTERVAL, True)
+
+ def timeout(self):
+ self.__sema.release() # start bdpoll loop in thread
+
+ def is_mounted(self, dev):
+ mounts = file('/proc/mounts').read()
+ return mounts.find(dev) != -1
+
+ def run(self):
+ sema = self.__sema
+ lock = self.__lock
+ messages = self.messages
+ mp = self.mp
+ self.running = True
+ while self.running:
+ sema.acquire()
+ self.__lock.acquire()
+ devices_to_poll = self.devices_to_poll.items()
+ self.__lock.release()
+ devices_to_poll_processed = [ ]
+ for device, state in devices_to_poll:
+ got_media = False
+ is_cdrom, prev_media_state = state
+ if is_cdrom:
+ try:
+ fd = os.open("/dev/" + device, os.O_RDONLY | os.O_NONBLOCK | os.O_EXCL)
+ except OSError, err:
+ if err.errno == errno.EBUSY:
+ print "open cdrom exclusive failed:",
+ if not self.is_mounted(device):
+ print "not mounted"
+ continue
+ try:
+ print "mounted... try non exclusive"
+ fd = os.open("/dev/" + device, os.O_RDONLY | os.O_NONBLOCK)
+ except OSError, err:
+ print "open cdrom not exclusive failed", os.strerror(err.errno)
+ continue
+ #here the fs must be valid!
+ try:
+ ret = fcntl.ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT)
+ except IOError, err:
+ print "ioctl CDROM_DRIVE_STATUS failed", os.strerror(err.errno)
+ else:
+ if ret in (CDS_NO_INFO, CDS_NO_DISC, CDS_TRAY_OPEN, CDS_DRIVE_NOT_READY):
+ pass
+ elif ret == CDS_DISC_OK:
+ #todo new kernels support events to userspace event on media change
+ #but not 2.6.18.... see hotplug-ng bdpoll.c
+ got_media = True
+ os.close(fd)
+ else:
+ try:
+ fd = os.open("/dev/" + device, os.O_RDONLY)
+ except OSError, err:
+ if err.errno == ENOMEDIUM:
+ pass
+ else:
+ print "open non cdrom failed", os.strerror(err.errno)
+ continue
+ else:
+ got_media = True
+ os.close(fd)
+ if prev_media_state:
+ if not got_media:
+ print "media removal detected on", device
+ try:
+ fd = os.open("/dev/" + device, os.O_RDONLY | os.O_NONBLOCK)
+ except OSError, err:
+ print "open device for blkrrpart ioctl failed", os.strerror(err.errno)
+ else:
+ try:
+ fcntl.ioctl(fd, BLKRRPART)
+ except IOError, err:
+ print "ioctl BLKRRPART failed", os.strerror(err.errno)
+ os.close(fd)
+ else:
+ if got_media:
+ print "media insertion detected on", device
+ devices_to_poll_processed.append((device, is_cdrom, got_media))
+ self.__lock.acquire()
+ for device, is_cdrom, state in devices_to_poll_processed:
+ old_state = self.devices_to_poll.get(device)
+ if old_state is not None and old_state[1] != state:
+ msg = state and BDPoll.MSG_MEDIUM_INSERTED or BDPoll.MSG_MEDIUM_REMOVED
+ self.devices_to_poll[device] = (is_cdrom, state)
+ messages.push((msg, device))
+ mp.send(0)
+
+ self.__lock.release()
+ messages.push((self.MSG_POLL_FINISHED,))
+ mp.send(0)
+
+ def addDevice(self, device, is_cdrom, inserted):
+ self.__lock.acquire()
+ if device in self.devices_to_poll:
+ print "device", device, "already in bdpoll"
+ else:
+ print "add device", device, "to bdpoll current state:",
+ if inserted:
+ print "medium inserted"
+ else:
+ print "medium removed"
+ self.devices_to_poll[device] = (is_cdrom, inserted)
+ self.__lock.release()
+
+ def removeDevice(self, device):
+ self.__lock.acquire()
+ if device in self.devices_to_poll:
+ print "device", device, "removed from bdpoll"
+ del self.devices_to_poll[device]
+ else:
+ print "try to del not exist device", device, "from bdpoll"
+ self.__lock.release()
+
+ netlink = Netlink()
+ bdpoll = BDPoll()
+ for blockdev, removable, is_cdrom, medium_found in harddiskmanager.devices_scanned_on_init:
+ if removable or is_cdrom:
+ bdpoll.addDevice(blockdev, is_cdrom, medium_found)
+ else:
+ from twisted.internet.protocol import Protocol, Factory
+ from twisted.internet import reactor
+
+ try:
+ import os
+ os.remove("/tmp/hotplug.socket")
+ except OSError:
+ pass
+
+ class Hotplug(Protocol):
+ def connectionMade(self):
+ print "HOTPLUG connection!"
+ self.received = ""
+
+ def dataReceived(self, data):
+ print "hotplug:", data
+ self.received += data
+ print "complete", self.received
+
+ def connectionLost(self, reason):
+ print "HOTPLUG connection lost!"
+ data = self.received.split('\0')[:-1]
+ v = {}
+
+ for x in data:
+ i = x.find('=')
+ var, val = x[:i], x[i+1:]
+ v[var] = val
+
+ processHotplugData(self, v)
- reactor.listenUNIX("/tmp/hotplug.socket", factory)
+ factory = Factory()
+ factory.protocol = Hotplug
+ reactor.listenUNIX("/tmp/hotplug.socket", factory)
def Plugins(**kwargs):
return PluginDescriptor(name = "Hotplug", description = "listens to hotplug events", where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart)
diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py
index ba96c071..3504d4cb 100755
--- a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py
+++ b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py
@@ -14,7 +14,7 @@ from Screens.TaskView import JobView
from Tools.Directories import fileExists
from Tools.HardwareInfo import HardwareInfo
from os import system
-from enigma import eConsoleAppContainer, quitMainloop
+from enigma import eConsoleAppContainer, quitMainloop, eEnv
from Components.About import about
class md5Postcondition(Condition):
@@ -51,7 +51,7 @@ class md5verify(Task):
class writeNAND(Task):
def __init__(self, job, param, box):
Task.__init__(self,job, ("Writing image file to NAND Flash"))
- self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/writenfi-mipsel-2.6.18-r1")
+ self.setTool(eEnv.resolve("${libdir}/enigma2/python/Plugins/SystemPlugins/NFIFlash/writenfi-mipsel-2.6.18-r1"))
if box == "dm7025":
self.end = 256
elif box[:5] == "dm800":
@@ -226,4 +226,4 @@ class NFIFlash(Screen):
if self.job.status == self.job.FINISHED:
self["status"].text = ("rebooting...")
from os import system
- system("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/kill_e2_reboot.sh")
+ system(eEnv.resolve("${libdir}/enigma2/python/Plugins/SystemPlugins/NFIFlash/kill_e2_reboot.sh"))
diff --git a/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py b/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py
index 997b9571..30cbb6b6 100755
--- a/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py
@@ -12,12 +12,13 @@ from Plugins.Plugin import PluginDescriptor
from Components.config import config
from Tools.Directories import resolveFilename, SCOPE_PLUGINS
from os import path, walk
+from enigma import eEnv
class SkinSelector(Screen):
# for i18n:
# _("Choose your Skin")
skinlist = []
- root = "/usr/share/enigma2/"
+ root = eEnv.resolve("${datadir}/enigma2/")
def __init__(self, session, args = None):
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py
index 7bd7d7a2..01649bb3 100755
--- a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py
@@ -11,7 +11,7 @@ from Components.config import config
from Components.ConfigList import ConfigList,ConfigListScreen
from Components.FileList import MultiFileSelectList
from Plugins.Plugin import PluginDescriptor
-from enigma import eTimer
+from enigma import eTimer, eEnv
from Tools.Directories import *
from os import popen, path, makedirs, listdir, access, stat, rename, remove, W_OK, R_OK
from time import gmtime, strftime, localtime
@@ -20,7 +20,7 @@ from datetime import date
config.plugins.configurationbackup = ConfigSubsection()
config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False)
-config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname'])
+config.plugins.configurationbackup.backupdirs = ConfigLocations(default=[eEnv.resolve('${sysconfdir}/enigma2/'), '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname'])
def getBackupPath():
backuppath = config.plugins.configurationbackup.backuplocation.value
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py
index 1797e4fe..32d7140a 100755
--- a/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py
@@ -9,13 +9,14 @@ from Plugins.Plugin import PluginDescriptor
from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
from Components.Pixmap import Pixmap, MovingPixmap, MultiPixmap
from os import popen, path, makedirs, listdir, access, stat, rename, remove, W_OK, R_OK
+from enigma import eEnv
from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations, ConfigBoolean
from Components.Harddisk import harddiskmanager
config.misc.firstrun = ConfigBoolean(default = True)
config.plugins.configurationbackup = ConfigSubsection()
config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False)
-config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf'])
+config.plugins.configurationbackup.backupdirs = ConfigLocations(default=[eEnv.resolve('${sysconfdir}/enigma2/'), '/etc/network/interfaces', '/etc/wpa_supplicant.conf'])
backupfile = "enigma2settingsbackup.tar.gz"
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py
index 707663a0..e1f3e1de 100755
--- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py
@@ -28,7 +28,7 @@ from Components.Network import iNetwork
from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR
from Tools.LoadPixmap import LoadPixmap
from Tools.NumericalTextInput import NumericalTextInput
-from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad, eRCInput, getPrevAsciiCode
+from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad, eRCInput, getPrevAsciiCode, eEnv
from cPickle import dump, load
from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK
from time import time, gmtime, strftime, localtime
@@ -43,7 +43,7 @@ from SoftwareTools import iSoftwareTools
config.plugins.configurationbackup = ConfigSubsection()
config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False)
-config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname'])
+config.plugins.configurationbackup.backupdirs = ConfigLocations(default=[eEnv.resolve('${sysconfdir}/enigma2/'), '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname'])
config.plugins.SoftwareManager = ConfigSubsection()
config.plugins.SoftwareManager.overwriteConfigFiles = ConfigSelection(
@@ -1684,7 +1684,7 @@ class PacketManager(Screen, NumericalTextInput):
self.cmdList = []
self.cachelist = []
self.cache_ttl = 86400 #600 is default, 0 disables, Seconds cache is considered valid (24h should be ok for caching ipkgs)
- self.cache_file = '/usr/lib/enigma2/python/Plugins/SystemPlugins/SoftwareManager/packetmanager.cache' #Path to cache directory
+ self.cache_file = eEnv.resolve('${libdir}/enigma2/python/Plugins/SystemPlugins/SoftwareManager/packetmanager.cache') #Path to cache directory
self.oktext = _("\nAfter pressing OK, please wait!")
self.unwanted_extensions = ('-dbg', '-dev', '-doc', 'busybox')
self.opkgAvail = fileExists('/usr/bin/opkg')
diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am b/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am
index cfdeb654..490a7720 100755
--- a/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am
+++ b/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am
@@ -1,4 +1,4 @@
-installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/TempFanControl
+installdir = $(pkglibdir)/python/Plugins/SystemPlugins/TempFanControl
SUBDIRS = meta
@@ -6,4 +6,4 @@ install_PYTHON = \
__init__.py \
plugin.py
-dist_install_DATA = LICENSE \ No newline at end of file
+dist_install_DATA = LICENSE
diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py
index 28ee363e..a13c7975 100755
--- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py
@@ -1,4 +1,4 @@
-from enigma import eTimer, eTPM
+from enigma import eTimer, eTPM, eEnv
from Screens.Screen import Screen
from Components.ActionMap import ActionMap, NumberActionMap
from Components.Pixmap import Pixmap,MultiPixmap
@@ -18,7 +18,7 @@ from Tools.HardwareInfo import HardwareInfo
from Wlan import Wlan, wpaSupplicant, iStatus
import sha
-plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan"
+plugin_path = eEnv.resolve("${libdir}/enigma2/python/Plugins/SystemPlugins/WirelessLan")
list = []
list.append("WEP")
diff --git a/lib/python/Plugins/newplugin.py b/lib/python/Plugins/newplugin.py
index c1c6f948..32c7269d 100644..100755
--- a/lib/python/Plugins/newplugin.py
+++ b/lib/python/Plugins/newplugin.py
@@ -137,7 +137,7 @@ def Plugins(**kwargs):
file.close()
makefile = open(pluginpath + "/Makefile.am", "w")
-makefile.write("""installdir = $(LIBDIR)/enigma2/python/Plugins/%s/%s
+makefile.write("""installdir = $(pkglibdir)/python/Plugins/%s/%s
install_PYTHON = \\
__init__.py \\
diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py
index 34316f01..c07e3495 100644
--- a/lib/python/Screens/ChannelSelection.py
+++ b/lib/python/Screens/ChannelSelection.py
@@ -8,7 +8,7 @@ from Components.MenuList import MenuList
from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
profile("ChannelSelection.py 1")
from EpgSelection import EPGSelection
-from enigma import eServiceReference, eEPGCache, eServiceCenter, eRCInput, eTimer, eDVBDB, iPlayableService, iServiceInformation, getPrevAsciiCode
+from enigma import eServiceReference, eEPGCache, eServiceCenter, eRCInput, eTimer, eDVBDB, iPlayableService, iServiceInformation, getPrevAsciiCode, eEnv
from Components.config import config, ConfigSubsection, ConfigText
from Tools.NumericalTextInput import NumericalTextInput
profile("ChannelSelection.py 2")
@@ -544,7 +544,7 @@ class ChannelSelectionEdit:
refstr = refstr[pos+14:]
pos = refstr.find('"')
if pos != -1:
- filename = '/etc/enigma2/' + refstr[:pos] # FIXMEEE !!! HARDCODED /etc/enigma2
+ filename = eEnv.resolve('${sysconfdir}/enigma2/') + refstr[:pos]
self.removeCurrentService()
try:
if filename is not None:
diff --git a/lib/python/Screens/Setup.py b/lib/python/Screens/Setup.py
index e9c3c680..61e6fdd7 100755
--- a/lib/python/Screens/Setup.py
+++ b/lib/python/Screens/Setup.py
@@ -4,6 +4,7 @@ from Components.config import config, ConfigNothing
from Components.SystemInfo import SystemInfo
from Components.ConfigList import ConfigListScreen
from Components.Sources.StaticText import StaticText
+from enigma import eEnv
import xml.etree.cElementTree
@@ -14,7 +15,7 @@ try:
setupfile = file('data/setup.xml', 'r')
except:
# if not found in the current path, we use the global datadir-path
- setupfile = file('/usr/share/enigma2/setup.xml', 'r')
+ setupfile = file(eEnv.resolve('${datadir}/enigma2/setup.xml'), 'r')
setupdom = xml.etree.cElementTree.parse(setupfile)
setupfile.close()
diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py
index a752d31c..61e1d5ef 100755
--- a/lib/python/Screens/Wizard.py
+++ b/lib/python/Screens/Wizard.py
@@ -10,7 +10,7 @@ from Components.ActionMap import NumberActionMap
from Components.MenuList import MenuList
from Components.ConfigList import ConfigList
from Components.Sources.List import List
-from enigma import eTimer
+from enigma import eTimer, eEnv
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
@@ -178,7 +178,7 @@ class Wizard(Screen):
parser.setContentHandler(wizardHandler)
for xmlfile in self.xmlfile:
if xmlfile[0] != '/':
- parser.parse('/usr/share/enigma2/' + xmlfile)
+ parser.parse(eEnv.resolve('${datadir}/enigma2/') + xmlfile)
else:
parser.parse(xmlfile)
diff --git a/lib/python/Tools/Directories.py b/lib/python/Tools/Directories.py
index 8ed2c8a4..518db49d 100755
--- a/lib/python/Tools/Directories.py
+++ b/lib/python/Tools/Directories.py
@@ -3,6 +3,7 @@
from os import path as os_path, mkdir, rmdir, system, walk, stat as os_stat, listdir, readlink, makedirs, error as os_error, symlink, access, F_OK, R_OK, W_OK
from stat import S_IMODE
from re import compile
+from enigma import eEnv
try:
from os import chmod
@@ -39,26 +40,26 @@ PATH_CREATE = 0
PATH_DONTCREATE = 1
PATH_FALLBACK = 2
defaultPaths = {
- SCOPE_TRANSPONDERDATA: ("/etc/", PATH_DONTCREATE),
- SCOPE_SYSETC: ("/etc/", PATH_DONTCREATE),
- SCOPE_FONTS: ("/usr/share/fonts/", PATH_DONTCREATE),
- SCOPE_CONFIG: ("/etc/enigma2/", PATH_CREATE),
- SCOPE_PLUGINS: ("/usr/lib/enigma2/python/Plugins/", PATH_CREATE),
+ SCOPE_TRANSPONDERDATA: (eEnv.resolve("${sysconfdir}/"), PATH_DONTCREATE),
+ SCOPE_SYSETC: (eEnv.resolve("${sysconfdir}/"), PATH_DONTCREATE),
+ SCOPE_FONTS: (eEnv.resolve("${datadir}/fonts/"), PATH_DONTCREATE),
+ SCOPE_CONFIG: (eEnv.resolve("${sysconfdir}/enigma2/"), PATH_CREATE),
+ SCOPE_PLUGINS: (eEnv.resolve("${libdir}/enigma2/python/Plugins/"), PATH_CREATE),
- SCOPE_LANGUAGE: ("/usr/share/enigma2/po/", PATH_DONTCREATE),
+ SCOPE_LANGUAGE: (eEnv.resolve("${datadir}/enigma2/po/"), PATH_DONTCREATE),
- SCOPE_SKIN: ("/usr/share/enigma2/", PATH_DONTCREATE),
- SCOPE_SKIN_IMAGE: ("/usr/share/enigma2/", PATH_DONTCREATE),
+ SCOPE_SKIN: (eEnv.resolve("${datadir}/enigma2/"), PATH_DONTCREATE),
+ SCOPE_SKIN_IMAGE: (eEnv.resolve("${datadir}/enigma2/"), PATH_DONTCREATE),
SCOPE_HDD: ("/hdd/movie/", PATH_DONTCREATE),
SCOPE_MEDIA: ("/media/", PATH_DONTCREATE),
- SCOPE_PLAYLIST: ("/etc/enigma2/playlist/", PATH_CREATE),
+ SCOPE_PLAYLIST: (eEnv.resolve("${sysconfdir}/enigma2/playlist/"), PATH_CREATE),
SCOPE_USERETC: ("", PATH_DONTCREATE), # user home directory
- SCOPE_DEFAULTDIR: ("/usr/share/enigma2/defaults/", PATH_CREATE),
+ SCOPE_DEFAULTDIR: (eEnv.resolve("${datadir}/enigma2/defaults/"), PATH_CREATE),
SCOPE_DEFAULTPARTITION: ("/dev/mtdblock/6", PATH_DONTCREATE),
- SCOPE_DEFAULTPARTITIONMOUNTDIR: ("/usr/share/enigma2/dealer", PATH_CREATE),
- SCOPE_METADIR: ("/usr/share/meta", PATH_CREATE),
+ SCOPE_DEFAULTPARTITIONMOUNTDIR: (eEnv.resolve("${datadir}/enigma2/dealer"), PATH_CREATE),
+ SCOPE_METADIR: (eEnv.resolve("${datadir}/meta"), PATH_CREATE),
}
FILE_COPY = 0 # copy files from fallback dir to the basedir
@@ -67,7 +68,7 @@ PATH_COPY = 2 # copy the complete fallback dir to the basedir
PATH_MOVE = 3 # move the fallback dir to the basedir (can be used for changes in paths)
fallbackPaths = {
SCOPE_CONFIG: [("/home/root/", FILE_MOVE),
- ("/usr/share/enigma2/defaults/", FILE_COPY)],
+ (eEnv.resolve("${datadir}/enigma2/defaults/"), FILE_COPY)],
SCOPE_HDD: [("/hdd/movies", PATH_MOVE)]
}
diff --git a/lib/python/connections.h b/lib/python/connections.h
index ad76198a..b4cd1c79 100644
--- a/lib/python/connections.h
+++ b/lib/python/connections.h
@@ -3,11 +3,6 @@
#include <libsig_comp.h>
- /* avoid warnigs :) */
-#include <features.h>
-#undef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 200112L
-
#include <lib/python/python.h>
class PSignal
diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i
index 19fb9254..7c999277 100644
--- a/lib/python/enigma_python.i
+++ b/lib/python/enigma_python.i
@@ -38,6 +38,7 @@ is usually caused by not marking PSignals as immutable.
#define SWIG_COMPILE
#include <lib/base/ebase.h>
#include <lib/base/smartptr.h>
+#include <lib/base/eenv.h>
#include <lib/base/eerror.h>
#include <lib/base/etpm.h>
#include <lib/base/nconfig.h>
@@ -50,7 +51,7 @@ is usually caused by not marking PSignals as immutable.
#include <lib/gdi/fb.h>
#include <lib/gdi/font.h>
#include <lib/gdi/gpixmap.h>
-#include <lib/gdi/gfbdc.h>
+#include <lib/gdi/gmaindc.h>
#include <lib/gui/ewidget.h>
#include <lib/gui/elabel.h>
#include <lib/gui/einput.h>
@@ -133,6 +134,7 @@ typedef long time_t;
%include "std_string.i"
%include <lib/python/swig.h>
%include <lib/base/object.h>
+%include <lib/base/eenv.h>
%include <lib/base/eerror.h>
%immutable eSocketNotifier::activated;
@@ -164,7 +166,7 @@ typedef long time_t;
%include <lib/gdi/fb.h>
%include <lib/gdi/font.h>
%include <lib/gdi/gpixmap.h>
-%include <lib/gdi/gfbdc.h>
+%include <lib/gdi/gmaindc.h>
%include <lib/gdi/epoint.h>
%include <lib/gdi/erect.h>
%include <lib/gdi/esize.h>
diff --git a/lib/python/python.h b/lib/python/python.h
index 18fdac78..f5b6e4d8 100644
--- a/lib/python/python.h
+++ b/lib/python/python.h
@@ -4,7 +4,6 @@
#define __lib_python_python_class_h
#endif
-#include <Python.h>
#include <string>
#include <lib/base/object.h>