summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-06-15 01:15:13 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-06-15 01:15:13 +0100
commit9d6c80bac902cb5c32146e2a891aa5e1317e144e (patch)
treeb7f0ee6d2fe101cb3f3fe999165987b6ccf9e756
parentc7ede2f1a564fa180e44d341f0019da443e9a005 (diff)
rearchitecture the data files
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r--CAO/Cards.py4
-rw-r--r--CAO/GameManager.py2
-rw-r--r--README2
-rw-r--r--setup.py26
-rw-r--r--usr/share/cao/lang/en/cards/black (renamed from lang/en/cards/black)0
-rw-r--r--usr/share/cao/lang/en/cards/white (renamed from lang/en/cards/white)0
-rw-r--r--usr/share/cao/lang/fr/cards/black (renamed from lang/fr/cards/black)0
-rw-r--r--usr/share/cao/lang/fr/cards/white (renamed from lang/fr/cards/white)0
8 files changed, 22 insertions, 12 deletions
diff --git a/CAO/Cards.py b/CAO/Cards.py
index b796b97..01909fb 100644
--- a/CAO/Cards.py
+++ b/CAO/Cards.py
@@ -2,12 +2,12 @@ class Cards():
@staticmethod
def get_white_cards(lang):
''' Read the file containing the white cards and return a list of cards '''
- with open('lang/' + lang + '/cards/white') as fd:
+ with open('usr/share/cao/lang/' + lang + '/cards/white') as fd:
return [line.strip() for line in fd]
@staticmethod
def get_black_cards(lang):
''' Read the file containing the black cards and return a list of cards '''
- with open('lang/' + lang + '/cards/black') as fd:
+ with open('usr/share/cao/lang/' + lang + '/cards/black') as fd:
return [line.strip() for line in fd]
diff --git a/CAO/GameManager.py b/CAO/GameManager.py
index 5600f1e..6e0d956 100644
--- a/CAO/GameManager.py
+++ b/CAO/GameManager.py
@@ -7,7 +7,7 @@ class GameManager():
def __init__(self):
self.langs = {}
- for filename in next(os.walk('lang'))[1]:
+ for filename in next(os.walk('usr/share/cao/lang'))[1]:
self.langs[filename] = {}
for lang in self.langs:
diff --git a/README b/README
index ca69bec..4c7fe82 100644
--- a/README
+++ b/README
@@ -15,7 +15,7 @@ Execution
Start the python server (it will listen to any connection on port 1236)
- $ cao-server &
+ $ chdir / && cao-server &
Installation of the web application
===================================
diff --git a/setup.py b/setup.py
index 1ab47e3..86a1f22 100644
--- a/setup.py
+++ b/setup.py
@@ -4,14 +4,24 @@ packages = [
'CAO',
]
-data_files = [
- ('lang', [
- 'lang/en/cards/black',
- 'lang/en/cards/white',
- 'lang/fr/cards/black',
- 'lang/fr/cards/white',
- ]),
- ]
+prefix = '/'
+share_dir = 'usr/share/cao/'
+
+data_files = list()
+
+import os
+
+for n in os.walk('usr'):
+ if len(n[2]) == 0:
+ continue
+
+ files = list()
+ for f in n[2]:
+ files.append(n[0] + '/' + f)
+
+ data_files.append((prefix + n[0] + '/', files))
+
+print(data_files)
scripts = [
'cao-server',
diff --git a/lang/en/cards/black b/usr/share/cao/lang/en/cards/black
index 9519bb7..9519bb7 100644
--- a/lang/en/cards/black
+++ b/usr/share/cao/lang/en/cards/black
diff --git a/lang/en/cards/white b/usr/share/cao/lang/en/cards/white
index 1c15a42..1c15a42 100644
--- a/lang/en/cards/white
+++ b/usr/share/cao/lang/en/cards/white
diff --git a/lang/fr/cards/black b/usr/share/cao/lang/fr/cards/black
index 1298307..1298307 100644
--- a/lang/fr/cards/black
+++ b/usr/share/cao/lang/fr/cards/black
diff --git a/lang/fr/cards/white b/usr/share/cao/lang/fr/cards/white
index b3766a7..b3766a7 100644
--- a/lang/fr/cards/white
+++ b/usr/share/cao/lang/fr/cards/white