Skip to content

Commit

Permalink
update create_deb file
Browse files Browse the repository at this point in the history
  • Loading branch information
kanishka-linux committed Nov 24, 2023
1 parent d57de54 commit 3834eba
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions ubuntu/create_deb.py
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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):
Expand All @@ -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'
Expand Down

0 comments on commit 3834eba

Please sign in to comment.