[+] Better build script

This commit is contained in:
Azalea 2024-04-23 07:42:08 -04:00
parent d47a63d237
commit 6f9155fe83
4 changed files with 389 additions and 12 deletions

View file

@ -31,6 +31,7 @@ setup(
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
packages=find_namespace_packages(),
package_data={'hyfetch': ['hyfetch/*']},

366
tools/bash_ignore.txt Normal file
View file

@ -0,0 +1,366 @@
git-bash.exe
git-cmd.exe
cmd
tmp
dev
bin/git.exe
bin/sh.exe
usr/share
usr/ssl
usr/libexec
usr/lib
usr/bin/git*
usr/bin/*vim*
usr/bin/*ssl*
usr/bin/*perl*
usr/bin/*gpg*
usr/bin/*ssh*
usr/bin/*crypto*
usr/bin/*view*
usr/bin/*svn*
usr/bin/ex*.exe
mingw32/share
mingw32/lib
mingw32/etc
mingw32/doc
mingw32/libexec
mingw32/bin/git*
mingw32/bin/Git*
mingw32/bin/Avalonia*
mingw32/bin/xz*
mingw32/bin/*ssl*
mingw32/bin/scalar.exe
mingw32/bin/libSkiaSharp.dll
mingw32/bin/*crypto*
mingw32/bin/*Microsoft.Identity*
mingw32/bin/*bz*
mingw32/bin/tcl*
mingw32/bin/*brotli*
mingw32/bin/av*
mingw32/bin/pdftotext.exe
mingw32/bin/libiconv-2.dll
mingw32/bin/libHarfBuzzSharp.dll
mingw32/bin/SkiaSharp.dll
mingw32/bin/libcurl-4.dll
mingw32/bin/libgmp-10.dll
mingw32/bin/System.Text.Json.dll
mingw32/bin/gcmcore.dll
mingw32/bin/curl.exe
# Automatically determined by access time
usr/bin/rebase.exe
usr/bin/rebaseall
usr/bin/start
usr/bin/column.exe
usr/bin/dash.exe
usr/bin/getopt.exe
usr/bin/znew
usr/bin/zless
usr/bin/zipinfo.exe
usr/bin/zipgrep
usr/bin/zgrep
usr/bin/zforce
usr/bin/zfgrep
usr/bin/zegrep
usr/bin/zdiff
usr/bin/zcmp
usr/bin/zcat
usr/bin/yes.exe
usr/bin/yat2m.exe
usr/bin/xxd.exe
usr/bin/xgettext.exe
usr/bin/xargs.exe
usr/bin/winpty.exe
usr/bin/wordpad
usr/bin/winpty.dll
usr/bin/winpty-debugserver.exe
usr/bin/winpty-agent.exe
usr/bin/whoami.exe
usr/bin/who.exe
usr/bin/which.exe
usr/bin/watchgnupg.exe
usr/bin/vi
usr/bin/vdir.exe
usr/bin/users.exe
usr/bin/updatedb
usr/bin/update-ca-trust
usr/bin/unzipsfx.exe
usr/bin/unzip.exe
usr/bin/unlink.exe
usr/bin/unix2mac.exe
usr/bin/unix2dos.exe
usr/bin/unexpand.exe
usr/bin/uncompress
usr/bin/umount.exe
usr/bin/u2d.exe
usr/bin/tzset.exe
usr/bin/tty.exe
usr/bin/tsort.exe
usr/bin/tset.exe
usr/bin/trust.exe
usr/bin/truncate.exe
usr/bin/true.exe
usr/bin/tr.exe
usr/bin/tput.exe
usr/bin/touch.exe
usr/bin/toe.exe
usr/bin/timeout.exe
usr/bin/tig.exe
usr/bin/tic.exe
usr/bin/test.exe
usr/bin/tee.exe
usr/bin/tar.exe
usr/bin/tail.exe
usr/bin/tac.exe
usr/bin/tabs.exe
usr/bin/sync.exe
usr/bin/sum.exe
usr/bin/stty.exe
usr/bin/strace.exe
usr/bin/stat.exe
usr/bin/ssp.exe
usr/bin/split.exe
usr/bin/sleep.exe
usr/bin/shuf.exe
usr/bin/shred.exe
usr/bin/sha512sum.exe
usr/bin/sha384sum.exe
usr/bin/sha256sum.exe
usr/bin/sha224sum.exe
usr/bin/sha1sum.exe
usr/bin/sftp.exe
usr/bin/sexp-conv.exe
usr/bin/setmetamode.exe
usr/bin/setfacl.exe
usr/bin/seq.exe
usr/bin/sdiff.exe
usr/bin/scp.exe
usr/bin/runcon.exe
usr/bin/rnano.exe
usr/bin/rmdir.exe
usr/bin/rm.exe
usr/bin/restore
usr/bin/reset.exe
usr/bin/regtool.exe
usr/bin/recode-sr-latin.exe
usr/bin/realpath.exe
usr/bin/readlink.exe
usr/bin/pwd.exe
usr/bin/ptx.exe
usr/bin/psl.exe
usr/bin/psl-make-dafsa
usr/bin/ps.exe
usr/bin/profiler.exe
usr/bin/printf.exe
usr/bin/printenv.exe
usr/bin/pr.exe
usr/bin/pldd.exe
usr/bin/pkcs1-conv.exe
usr/bin/pinky.exe
usr/bin/pinentry.exe
usr/bin/pinentry-w32.exe
usr/bin/pathchk.exe
usr/bin/patch.exe
usr/bin/paste.exe
usr/bin/passwd.exe
usr/bin/p11-kit.exe
usr/bin/od.exe
usr/bin/numfmt.exe
usr/bin/nproc.exe
usr/bin/notepad
usr/bin/nohup.exe
usr/bin/nl.exe
usr/bin/nice.exe
usr/bin/ngettext.exe
usr/bin/nettle-pbkdf2.exe
usr/bin/nettle-lfib-stream.exe
usr/bin/nettle-hash.exe
usr/bin/nano.exe
usr/bin/mv.exe
usr/bin/msys-z.dll
usr/bin/msys-wind-0.dll
usr/bin/msys-unistring-2.dll
usr/bin/msys-ticw6.dll
usr/bin/msys-tasn1-6.dll
usr/bin/msys-sqlite3-0.dll
usr/bin/msys-smartcols-1.dll
usr/bin/msys-serf-1-0.dll
usr/bin/msys-sasl2-3.dll
usr/bin/msys-roken-18.dll
usr/bin/msys-psl-5.dll
usr/bin/msys-pcre2-posix-3.dll
usr/bin/msys-pcre2-8-0.dll
usr/bin/msys-p11-kit-0.dll
usr/bin/msys-npth-0.dll
usr/bin/msys-nettle-8.dll
usr/bin/msys-magic-1.dll
usr/bin/msys-lz4-1.dll
usr/bin/msys-ksba-8.dll
usr/bin/msys-krb5-26.dll
usr/bin/msys-kafs-0.dll
usr/bin/msys-idn2-0.dll
usr/bin/msys-hx509-5.dll
usr/bin/msys-hogweed-6.dll
usr/bin/msys-heimntlm-0.dll
usr/bin/msys-heimbase-1.dll
usr/bin/msys-gssapi-3.dll
usr/bin/msys-gobject-2.0-0.dll
usr/bin/msys-gnutls-30.dll
usr/bin/msys-gmodule-2.0-0.dll
usr/bin/msys-glib-2.0-0.dll
usr/bin/msys-gio-2.0-0.dll
usr/bin/msys-gettextsrc-0-19-8-1.dll
usr/bin/msys-gettextlib-0-19-8-1.dll
usr/bin/msys-gcrypt-20.dll
usr/bin/msys-fido2-1.dll
usr/bin/msys-ffi-7.dll
usr/bin/msys-expat-1.dll
usr/bin/msys-edit-0.dll
usr/bin/msys-crypt-0.dll
usr/bin/msys-com_err-1.dll
usr/bin/msys-cbor-0.11.dll
usr/bin/msys-bz2-1.dll
usr/bin/msys-assuan-0.dll
usr/bin/msys-asn1-8.dll
usr/bin/msys-aprutil-1-0.dll
usr/bin/msys-apr-1-0.dll
usr/bin/msguniq.exe
usr/bin/msgunfmt.exe
usr/bin/msgmerge.exe
usr/bin/msginit.exe
usr/bin/msggrep.exe
usr/bin/msgfmt.exe
usr/bin/msgfilter.exe
usr/bin/msgexec.exe
usr/bin/msgen.exe
usr/bin/msgconv.exe
usr/bin/msgcomm.exe
usr/bin/msgcmp.exe
usr/bin/msgcat.exe
usr/bin/msgattrib.exe
usr/bin/mpicalc.exe
usr/bin/mount.exe
usr/bin/mktemp.exe
usr/bin/mkpasswd.exe
usr/bin/mknod.exe
usr/bin/mkgroup.exe
usr/bin/mkfifo.exe
usr/bin/mkdir.exe
usr/bin/mintty.exe
usr/bin/mintheme
usr/bin/minidumper.exe
usr/bin/md5sum.exe
usr/bin/mac2unix.exe
usr/bin/lsattr.exe
usr/bin/ls.exe
usr/bin/logname.exe
usr/bin/locate.exe
usr/bin/locale.exe
usr/bin/ln.exe
usr/bin/link.exe
usr/bin/lesskey.exe
usr/bin/lessecho.exe
usr/bin/less.exe
usr/bin/ldh.exe
usr/bin/ldd.exe
usr/bin/kill.exe
usr/bin/kbxutil.exe
usr/bin/join.exe
usr/bin/install.exe
usr/bin/infotocap.exe
usr/bin/infocmp.exe
usr/bin/iconv.exe
usr/bin/hostname.exe
usr/bin/hostid.exe
usr/bin/hmac256.exe
usr/bin/head.exe
usr/bin/gzip.exe
usr/bin/gzexe
usr/bin/gunzip
usr/bin/gsettings.exe
usr/bin/groups.exe
usr/bin/gobject-query.exe
usr/bin/gmondump.exe
usr/bin/glib-compile-schemas.exe
usr/bin/gkill.exe
usr/bin/gio-querymodules.exe
usr/bin/gettextize
usr/bin/gettext.sh
usr/bin/gettext.exe
usr/bin/getflags
usr/bin/getfacl.exe
usr/bin/getemojis
usr/bin/getconf.exe
usr/bin/gencat.exe
usr/bin/gdbus.exe
usr/bin/gawk.exe
usr/bin/gawk-5.0.0.exe
usr/bin/gapplication.exe
usr/bin/funzip.exe
usr/bin/fold.exe
usr/bin/fmt.exe
usr/bin/find.exe
usr/bin/file.exe
usr/bin/fgrep
usr/bin/false.exe
usr/bin/factor.exe
usr/bin/envsubst.exe
usr/bin/env.exe
usr/bin/egrep
usr/bin/echo.exe
usr/bin/dumpsexp.exe
usr/bin/du.exe
usr/bin/dos2unix.exe
usr/bin/docx2txt.pl
usr/bin/docx2txt
usr/bin/dirmngr.exe
usr/bin/dirmngr-client.exe
usr/bin/dircolors.exe
usr/bin/dir.exe
usr/bin/diff3.exe
usr/bin/diff.exe
usr/bin/df.exe
usr/bin/dd.exe
usr/bin/date.exe
usr/bin/d2u.exe
usr/bin/cygwin-console-helper.exe
usr/bin/cygcheck.exe
usr/bin/cut.exe
usr/bin/csplit.exe
usr/bin/cp.exe
usr/bin/comm.exe
usr/bin/cmp.exe
usr/bin/clear.exe
usr/bin/cksum.exe
usr/bin/chroot.exe
usr/bin/chown.exe
usr/bin/chmod.exe
usr/bin/chgrp.exe
usr/bin/chcon.exe
usr/bin/chattr.exe
usr/bin/cat.exe
usr/bin/captoinfo.exe
usr/bin/c_rehash
usr/bin/bzless
usr/bin/bzip2recover.exe
usr/bin/bzip2.exe
usr/bin/bzgrep
usr/bin/bzfgrep
usr/bin/bzegrep
usr/bin/bzdiff
usr/bin/bzcmp
usr/bin/bzcat.exe
usr/bin/bunzip2.exe
usr/bin/bashbug
usr/bin/basenc.exe
usr/bin/basename.exe
usr/bin/base64.exe
usr/bin/base32.exe
usr/bin/backup
usr/bin/b2sum.exe
usr/bin/autopoint
usr/bin/astextplain
usr/bin/arch.exe
usr/bin/applygnupgdefaults
usr/bin/addgnupghome
usr/bin/[.exe

19
tools/build_bash.sh Normal file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
# This script is used to build a customized Git Bash for windows pacakge that only include bash and no other unnecessary files
# Get script directory
DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd $DIR/../dist
# Get the git distribution if it doesn't exist
if [ ! -f git.tar.bz2 ]; then
# NOTE: Git for Windows v2.44 is the last release to support Windows 7 and 8
URL="https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-32-bit.tar.bz2"
wget $URL -O git.tar.bz2
fi
# Unzip the git distribution to git directory
# Ignore the unnecessary files
rm -rf git
mkdir git
tar -xvf git.tar.bz2 -C git --exclude-from="$DIR/bash_ignore.txt"

View file

@ -22,17 +22,8 @@ cd dist
# Get the file name
file=$(ls | grep .whl)
# Get the git distribution if it doesn't exist
if [ ! -f git.tar.bz2 ]; then
#URL="https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-64-bit.tar.bz2"
# NOTE: Git for Windows v2.44 is the last release to support Windows 7 and 8
URL="https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-32-bit.tar.bz2"
wget $URL -O git.tar.bz2
fi
# Unzip the git distribution to git directory
mkdir git
tar -xvf git.tar.bz2 -C git
# Build bash pacakge
$DIR/build_bash.sh
# Unzip the wheel
unzip $file -d wheel
@ -44,7 +35,7 @@ cp -r git/ wheel/hyfetch/
new_name="$(echo $file | sed 's/-none-any/-win32/')"
# Zip the wheel to win_amd64.whl
cd wheel && zip -r "../$new_name" * && cd ..
cd wheel && zip -y -r "../$new_name" * && cd ..
# Check again
twine check $new_name