Skip to content

Instantly share code, notes, and snippets.

@themagiulio
Last active May 13, 2021 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themagiulio/4faae10ac7514cb2e26e8bc1009e83e4 to your computer and use it in GitHub Desktop.
Save themagiulio/4faae10ac7514cb2e26e8bc1009e83e4 to your computer and use it in GitHub Desktop.
Build Bandcamp Desktop from master branch
import os
import platform
import inquirer
from git import Repo, remote
from pynpm import NPMPackage as npm
class Progress(remote.RemoteProgress):
def update(self, op_code, cur_count, max_count=None, message=''):
print(self._cur_line)
dirpath = os.path.join(os.getcwd(), 'bandcamp-desktop')
oss = ['Current Operating System', 'Windows', 'Mac OS', 'Linux']
questions = [
inquirer.List(
'os_user',
message='Which platform would you like to build the software for?',
choices=oss,
)
]
if os.path.exists(dirpath):
print('A directory called "bandcamp-desktop" already exists. Please delete it or rename it in order to continue')
exit()
Repo.clone_from(
'git://github.com/themagiulio/bandcamp-desktop.git',
dirpath,
progress=Progress()
)
pkg = npm(os.path.join(dirpath, 'package.json'))
pkg.install()
os_user = platform.system()
answers = inquirer.prompt(questions)
if answers['os_user'] == oss[1]:
os_user = '--win'
elif answers['os_user'] == oss[2]:
os_user = '--mac'
elif answers['os_user'] == oss[3]:
os_user = '--linux'
else:
if os_user == 'Windows':
os_user = '--win'
elif os_user == 'Darwin':
os_user = '--mac'
else:
os_user = '--linux'
pkg.run_script('build', os_user, '--ia32')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment