summaryrefslogtreecommitdiffstats
path: root/cambalache/installation-changes.patch
blob: 77f888f166b05ccd6b36c21204106cbd6aa6b249 (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
From 16c43a33d67cdbf0be3569c2221b873c9df855f4 Mon Sep 17 00:00:00 2001
From: Lyes Saadi <mail@lyes.eu>
Date: Thu, 22 Jul 2021 01:21:41 +0100
Subject: [PATCH 1/1] Conforming to distributions packaging requirements

This introduces several changes to the installation scripts in
order to account for distributions' requirements (Fedora
specifically). This include the installation of python source
files alongside bytecode cache pyc files as well as the
installation of python files in the standard /usr/lib/python3.9/
directory as python modules.
---
 cambalacheui/meson.build | 32 +++++++++++++++-----------------
 merengue/merengue.in     |  5 +----
 merengue/meson.build     | 26 ++++++++++++--------------
 run-dev.py               | 11 +++++------
 src/cambalache.in        |  4 +---
 src/meson.build          | 10 ++++------
 6 files changed, 38 insertions(+), 50 deletions(-)

diff --git a/cambalacheui/meson.build b/cambalacheui/meson.build
index 5ee9409..b97b173 100644
--- a/cambalacheui/meson.build
+++ b/cambalacheui/meson.build
@@ -20,24 +20,22 @@ configure_file(
   install_dir: moduledir
 )
 
-run_command('python3', '-m', 'compileall', '-b', '.')
-
 install_data([
-    'cmb_base.pyc',
-    'cmb_db.pyc',
-    'cmb_objects_base.pyc',
-    'cmb_tree_view.pyc',
-    'cmb_list_store.pyc',
-    'cmb_ui.pyc',
-    'cmb_property.pyc',
-    'cmb_layout_property.pyc',
-    'cmb_type_info.pyc',
-    'cmb_object.pyc',
-    'cmb_view.pyc',
-    'cmb_object_editor.pyc',
-    'cmb_project.pyc',
-    'cmb_signal_editor.pyc',
-    '__init__.pyc'
+    'cmb_base.py',
+    'cmb_db.py',
+    'cmb_objects_base.py',
+    'cmb_tree_view.py',
+    'cmb_list_store.py',
+    'cmb_ui.py',
+    'cmb_property.py',
+    'cmb_layout_property.py',
+    'cmb_type_info.py',
+    'cmb_object.py',
+    'cmb_view.py',
+    'cmb_object_editor.py',
+    'cmb_project.py',
+    'cmb_signal_editor.py',
+    '__init__.py',
     ],
     install_dir: moduledir)
 
diff --git a/merengue/merengue.in b/merengue/merengue.in
index 7a18d22..a04b010 100755
--- a/merengue/merengue.in
+++ b/merengue/merengue.in
@@ -12,16 +12,13 @@ import gi
 import sys
 import signal
 
-pkgdatadir = '@pkgdatadir@'
-
-sys.path.insert(1, pkgdatadir)
 signal.signal(signal.SIGINT, signal.SIG_DFL)
 
 from gi.repository import GLib
 
 if __name__ == "__main__":
     if len(sys.argv) != 2:
-        print(f"Ussage: {sys.argv[0]} gtkversion", file=sys.stderr)
+        print(f"Usage: {sys.argv[0]} gtkversion", file=sys.stderr)
         exit()
 
     version = sys.argv[1]
diff --git a/merengue/meson.build b/merengue/meson.build
index 05a244b..c7c63c1 100644
--- a/merengue/meson.build
+++ b/merengue/meson.build
@@ -1,5 +1,5 @@
 pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), 'merengue')
-moduledir = join_paths(pkgdatadir, 'merengue')
+moduledir = join_paths(get_option('prefix'), python_bin.get_install_dir(), 'merengue')
 
 gnome.compile_resources('merengue',
   'merengue.gresource.xml',
@@ -29,35 +29,33 @@ configure_file(
   install_dir: get_option('bindir')
 )
 
-run_command('python3', '-m', 'compileall', '-b', '.')
-
 install_data([
-  'mrg_application.pyc',
-  '__init__.pyc',
+  'mrg_application.py',
+  '__init__.py',
   ],
   install_dir: moduledir
 )
 
 install_data([
-  'controller/__init__.pyc',
-  'controller/mrg_controller.pyc',
-  'controller/mrg_controller_registry.pyc',
+  'controller/__init__.py',
+  'controller/mrg_controller.py',
+  'controller/mrg_controller_registry.py',
   ],
   install_dir: join_paths(moduledir, 'controller')
 )
 
 install_data([
-  'mrg_gtk/__init__.pyc',
-  'mrg_gtk/mrg_selection.pyc',
-  'mrg_gtk/mrg_gtk_widget.pyc',
-  'mrg_gtk/mrg_gtk_window.pyc',
+  'mrg_gtk/__init__.py',
+  'mrg_gtk/mrg_selection.py',
+  'mrg_gtk/mrg_gtk_widget.py',
+  'mrg_gtk/mrg_gtk_window.py',
   ],
   install_dir: join_paths(moduledir, 'mrg_gtk')
 )
 
 install_data([
-  'utils/__init__.pyc',
-  'utils/utils.pyc',
+  'utils/__init__.py',
+  'utils/utils.py',
   ],
   install_dir: join_paths(moduledir, 'utils')
 )
diff --git a/run-dev.py b/run-dev.py
index b1c9bd2..57f0060 100755
--- a/run-dev.py
+++ b/run-dev.py
@@ -7,7 +7,6 @@
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as
 # published by the Free Software Foundation; version 2 of the License.
-#
 # 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
@@ -33,6 +32,7 @@ basedir = os.path.dirname(__file__)
 sys.path.insert(1, basedir)
 
 os.environ['PATH'] = os.path.join(basedir, 'merengue') + ':' + os.environ.get('PATH')
+os.environ['PYTHONPATH'] = basedir + ':' + str(os.environ.get('PYTHONPATH') or '')
 
 glib_compile_resources = GLib.find_program_in_path ('glib-compile-resources')
 
@@ -94,16 +94,15 @@ if __name__ == '__main__':
 
     # Create config files pointing to source directories
     dev_config('cambalacheui/config.py',
-               f"VERSION = 'git'\npkgdatadir = '{os.path.abspath('cambalacheui')}'")
+               f"VERSION = 'git'")
     dev_config('merengue/config.py',
-               f"VERSION = 'git'\npkgdatadir = '{os.path.abspath('merengue')}'")
+               f"VERSION = 'git'")
     dev_config('src/config.py',
-               f"VERSION = 'git'\npkgdatadir = '{os.path.abspath('src')}'")
+               f"VERSION = 'git'")
 
     # Create merengue bin script
     configure_file('merengue/merengue.in', 'merengue/merengue', {
-        'PYTHON': GLib.find_program_in_path('python3'),
-        'pkgdatadir': os.path.abspath('.')
+        'PYTHON': GLib.find_program_in_path('python3')
     })
     os.chmod('merengue/merengue', stat.S_IREAD | stat.S_IWRITE | stat.S_IEXEC)
 
diff --git a/src/cambalache.in b/src/cambalache.in
index c0adbf0..d85f13c 100755
--- a/src/cambalache.in
+++ b/src/cambalache.in
@@ -11,12 +11,10 @@ import os
 import sys
 import signal
 
-pkgdatadir = '@pkgdatadir@'
 localedir = '@localedir@'
 
-sys.path.insert(1, pkgdatadir)
 signal.signal(signal.SIGINT, signal.SIG_DFL)
-print(pkgdatadir, localedir)
+print(localedir)
 
 import locale
 locale.bindtextdomain("cambalache", localedir)
diff --git a/src/meson.build b/src/meson.build
index 683cdff..81f3ea9 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,5 +1,5 @@
 pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), 'cambalache')
-moduledir = join_paths(pkgdatadir, 'cambalache')
+moduledir = join_paths(get_option('prefix'), python_bin.get_install_dir(), 'cambalache')
 
 gnome.compile_resources('cambalache',
   'cambalache.gresource.xml',
@@ -30,12 +30,10 @@ configure_file(
   install_dir: moduledir
 )
 
-run_command('python3', '-m', 'compileall', '-b', '.')
-
 install_data([
-    '__init__.pyc',
-    'cmb_application.pyc',
-    'cmb_window.pyc'
+    '__init__.py',
+    'cmb_application.py',
+    'cmb_window.py',
     ],
     install_dir: moduledir)
 
-- 
2.31.1