[nanny] mv effective_tld_names.dat to share
- From: Roberto Majadas <telemaco src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nanny] mv effective_tld_names.dat to share
- Date: Sun, 23 Jan 2011 18:08:14 +0000 (UTC)
commit c175dcf7bec9741811900368dac7d3c98972c0cd
Author: Roberto Majadas <roberto majadas openshine com>
Date: Mon Jan 17 11:48:06 2011 +0100
mv effective_tld_names.dat to share
configure.ac | 2 ++
daemon/data/Makefile.am | 2 +-
daemon/data/etld/Makefile.am | 4 ++++
daemon/{src => data/etld}/effective_tld_names.dat | 0
daemon/src/Makefile.am | 5 -----
daemon/src/{etld.py => etld.py.in} | 18 ++++++++++++++++--
6 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1ab0c75..8a96524 100644
--- a/configure.ac
+++ b/configure.ac
@@ -274,7 +274,9 @@ daemon/data/init.d/debian/Makefile
daemon/data/init.d/redhat/Makefile
daemon/data/init.d/suse/Makefile
daemon/data/init.d/mandriva/Makefile
+daemon/data/etld/Makefile
daemon/src/Makefile
+daemon/src/etld.py
daemon/src/proxy/Makefile
help/Makefile
man/Makefile
diff --git a/daemon/data/Makefile.am b/daemon/data/Makefile.am
index 3dae9e3..76de00d 100644
--- a/daemon/data/Makefile.am
+++ b/daemon/data/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS=applists dbus init.d
+SUBDIRS=applists dbus init.d etld
if NANNY_POSIX_SUPPORT
policy_in_files = org.gnome.nanny.policy.in
diff --git a/daemon/data/etld/Makefile.am b/daemon/data/etld/Makefile.am
new file mode 100644
index 0000000..b264e9c
--- /dev/null
+++ b/daemon/data/etld/Makefile.am
@@ -0,0 +1,4 @@
+etlddir = $(datadir)/nanny/etld/
+etld_DATA = effective_tld_names.dat
+
+EXTRA_DIST = effective_tld_names.dat
diff --git a/daemon/src/effective_tld_names.dat b/daemon/data/etld/effective_tld_names.dat
similarity index 100%
rename from daemon/src/effective_tld_names.dat
rename to daemon/data/etld/effective_tld_names.dat
diff --git a/daemon/src/Makefile.am b/daemon/src/Makefile.am
index 37b13f9..03351d4 100644
--- a/daemon/src/Makefile.am
+++ b/daemon/src/Makefile.am
@@ -24,11 +24,6 @@ corelib_PYTHON = __init__.py \
-effectivedir = $(pythondir)/nanny/daemon
-effective_DATA = effective_tld_names.dat
-
-EXTRA_DIST = effective_tld_names.dat
-
if HAS_HACHOIR_REGEX
dgimporterdir = $(pythondir)/nanny/daemon
dgimporter_PYTHON = DansGuardianImporter.py
diff --git a/daemon/src/etld.py b/daemon/src/etld.py.in
similarity index 67%
rename from daemon/src/etld.py
rename to daemon/src/etld.py.in
index 3f92e50..aeed30b 100644
--- a/daemon/src/etld.py
+++ b/daemon/src/etld.py.in
@@ -20,8 +20,22 @@ import sys
import time
from urlparse import urlparse
-with open (os.path.join (os.path.dirname(__file__), 'effective_tld_names.dat')) as tldFile:
- TLDS = set([line.strip() for line in tldFile if line[0] not in "/\n"])
+if os.name == "posix":
+ with open (os.path.join ('@prefix@', 'share', 'nanny', 'etld', 'effective_tld_names.dat')) as tldFile:
+ TLDS = set([line.strip() for line in tldFile if line[0] not in "/\n"])
+elif os.name == "nt" :
+ if not hasattr(sys, "frozen") :
+ file_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+ for x in range(6):
+ file_dir = os.path.dirname(file_dir)
+ root_path = file_dir
+ etld_dat = os.path.join(root_path, "share", "nanny", "etld", 'effective_tld_names.dat')
+ else:
+ root_path = os.path.dirname(os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding( ))))
+ etld_dat = os.path.join(root_path, "share", "nanny", "etld", 'effective_tld_names.dat')
+
+ with open (etld_dat) as tldFile:
+ TLDS = set([line.strip() for line in tldFile if line[0] not in "/\n"])
class etld(object):
"""Helper to determine the effective TLD portion of a domain name."""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]