Skip to content

Commit 3834eba

Browse files
update create_deb file
1 parent d57de54 commit 3834eba

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

ubuntu/create_deb.py

+28
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
11
import os
22
import sys
3+
import site
34
import shutil
45
import subprocess
56

67
BASEDIR,BASEFILE = os.path.split(os.path.abspath(__file__))
78
print(BASEDIR,BASEFILE,os.getcwd())
89

10+
sitepkg = site.getsitepackages()[0]
11+
912
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+
1035
src_dir = os.path.join(par_dir,'kawaii_player')
1136

1237
deb_config_dir = os.path.join(BASEDIR,'DEBIAN')
@@ -26,6 +51,7 @@
2651

2752
usr_share = os.path.join(dest_dir,'usr','share','applications')
2853
usr_bin = os.path.join(dest_dir,'usr','bin')
54+
lib_path = os.path.join(dest_dir, sitepkg[1:])
2955
usr_share_kawaii = os.path.join(dest_dir,'usr','share','kawaii-player')
3056

3157
class DpkgDebError(Exception):
@@ -37,9 +63,11 @@ class DpkgDebError(Exception):
3763
os.makedirs(dest_dir)
3864
os.makedirs(usr_share)
3965
os.makedirs(usr_bin)
66+
os.makedirs(lib_path)
4067
shutil.copytree(deb_config_dir,os.path.join(dest_dir,'DEBIAN'))
4168
shutil.copy(exec_file,usr_bin)
4269
shutil.copy(desk_file,usr_share)
70+
shutil.copy(mpv_so_file,lib_path)
4371
shutil.copytree(src_dir,usr_share_kawaii)
4472
dpkg_errcode = subprocess.call(['dpkg-deb','--build',dest_dir])
4573
deb_pkg = './'+os.path.basename(dest_dir)+'.deb'

0 commit comments

Comments
 (0)