From 3834eba353fd22c798704618597ca291588e6bad Mon Sep 17 00:00:00 2001 From: kanishka-linux Date: Sat, 25 Nov 2023 03:27:46 +0530 Subject: [PATCH] update create_deb file --- ubuntu/create_deb.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ubuntu/create_deb.py b/ubuntu/create_deb.py index cf11998..ddcb57e 100644 --- a/ubuntu/create_deb.py +++ b/ubuntu/create_deb.py @@ -1,12 +1,37 @@ import os import sys +import site import shutil import subprocess BASEDIR,BASEFILE = os.path.split(os.path.abspath(__file__)) print(BASEDIR,BASEFILE,os.getcwd()) +sitepkg = site.getsitepackages()[0] + par_dir,cur_dir = os.path.split(BASEDIR) + +os.chdir(par_dir) + +subprocess.call(["pip3", "wheel", "."]) + +whl = list(filter(lambda x: x.endswith(".whl"), os.listdir(par_dir)))[0] + +whl_path = os.path.join(par_dir, whl) +shutil.copy(whl_path, BASEDIR) + +os.chdir(BASEDIR) + +subprocess.call(["unzip", whl]) + +mpv_so = list(filter(lambda x: x.endswith(".so"), os.listdir(BASEDIR)))[0] + +mpv_so_file = os.path.join(BASEDIR, mpv_so) + +extra_dir = os.path.join(BASEDIR, "kawaii_player") + +shutil.rmtree(extra_dir) + src_dir = os.path.join(par_dir,'kawaii_player') deb_config_dir = os.path.join(BASEDIR,'DEBIAN') @@ -26,6 +51,7 @@ usr_share = os.path.join(dest_dir,'usr','share','applications') usr_bin = os.path.join(dest_dir,'usr','bin') +lib_path = os.path.join(dest_dir, sitepkg[1:]) usr_share_kawaii = os.path.join(dest_dir,'usr','share','kawaii-player') class DpkgDebError(Exception): @@ -37,9 +63,11 @@ class DpkgDebError(Exception): os.makedirs(dest_dir) os.makedirs(usr_share) os.makedirs(usr_bin) + os.makedirs(lib_path) shutil.copytree(deb_config_dir,os.path.join(dest_dir,'DEBIAN')) shutil.copy(exec_file,usr_bin) shutil.copy(desk_file,usr_share) + shutil.copy(mpv_so_file,lib_path) shutil.copytree(src_dir,usr_share_kawaii) dpkg_errcode = subprocess.call(['dpkg-deb','--build',dest_dir]) deb_pkg = './'+os.path.basename(dest_dir)+'.deb'