1
1
import os
2
2
import sys
3
+ import site
3
4
import shutil
4
5
import subprocess
5
6
6
7
BASEDIR ,BASEFILE = os .path .split (os .path .abspath (__file__ ))
7
8
print (BASEDIR ,BASEFILE ,os .getcwd ())
8
9
10
+ sitepkg = site .getsitepackages ()[0 ]
11
+
9
12
par_dir ,cur_dir = os .path .split (BASEDIR )
13
+
14
+ os .chdir (par_dir )
15
+
16
+ subprocess .call (["pip3" , "wheel" , "." ])
17
+
18
+ whl = list (filter (lambda x : x .endswith (".whl" ), os .listdir (par_dir )))[0 ]
19
+
20
+ whl_path = os .path .join (par_dir , whl )
21
+ shutil .copy (whl_path , BASEDIR )
22
+
23
+ os .chdir (BASEDIR )
24
+
25
+ subprocess .call (["unzip" , whl ])
26
+
27
+ mpv_so = list (filter (lambda x : x .endswith (".so" ), os .listdir (BASEDIR )))[0 ]
28
+
29
+ mpv_so_file = os .path .join (BASEDIR , mpv_so )
30
+
31
+ extra_dir = os .path .join (BASEDIR , "kawaii_player" )
32
+
33
+ shutil .rmtree (extra_dir )
34
+
10
35
src_dir = os .path .join (par_dir ,'kawaii_player' )
11
36
12
37
deb_config_dir = os .path .join (BASEDIR ,'DEBIAN' )
26
51
27
52
usr_share = os .path .join (dest_dir ,'usr' ,'share' ,'applications' )
28
53
usr_bin = os .path .join (dest_dir ,'usr' ,'bin' )
54
+ lib_path = os .path .join (dest_dir , sitepkg [1 :])
29
55
usr_share_kawaii = os .path .join (dest_dir ,'usr' ,'share' ,'kawaii-player' )
30
56
31
57
class DpkgDebError (Exception ):
@@ -37,9 +63,11 @@ class DpkgDebError(Exception):
37
63
os .makedirs (dest_dir )
38
64
os .makedirs (usr_share )
39
65
os .makedirs (usr_bin )
66
+ os .makedirs (lib_path )
40
67
shutil .copytree (deb_config_dir ,os .path .join (dest_dir ,'DEBIAN' ))
41
68
shutil .copy (exec_file ,usr_bin )
42
69
shutil .copy (desk_file ,usr_share )
70
+ shutil .copy (mpv_so_file ,lib_path )
43
71
shutil .copytree (src_dir ,usr_share_kawaii )
44
72
dpkg_errcode = subprocess .call (['dpkg-deb' ,'--build' ,dest_dir ])
45
73
deb_pkg = './' + os .path .basename (dest_dir )+ '.deb'
0 commit comments