-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9eef5c4
commit 2a62472
Showing
7 changed files
with
195 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
""" Operations | ||
Common operations used by installer scripts | ||
""" | ||
|
||
import os | ||
import shutil | ||
import stat | ||
import wget | ||
|
||
|
||
class Operation: | ||
|
||
def copy_file(self, source, destination): | ||
print("Copying " + source) | ||
shutil.copy(source, destination) | ||
|
||
def download_file(self, url, out_dir="."): | ||
print("downloading " + url) | ||
wget.download(url, out=out_dir) | ||
|
||
def execute_mode(self, file): | ||
print("changing mode of " + file + " to group-execute ") | ||
os.chmod(file, stat.S_IXGRP) | ||
|
||
def extract_archive(self, file_name, dest, type='gztar'): | ||
print("extracting " + file_name + " to " + dest) | ||
shutil.unpack_archive(file_name, dest, type) | ||
|
||
def make_directory(self, path): | ||
print("create directory at " + path) | ||
try: | ||
os.makedirs(path) | ||
except: | ||
print("Directory already exists or Invalid path.") |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
""" mac installer | ||
Install fontman on Mac platforms | ||
""" | ||
|
||
import os, shutil, stat, time, wget | ||
from os.path import expanduser | ||
|
||
from Operation import Operation | ||
from artifacts import base_url, fms_darwin_64, fms_darwin_86, gui_darwin_64, \ | ||
gui_darwin_86, version | ||
from install import arch, print_info | ||
|
||
|
||
def install(): | ||
o = Operation() | ||
time.sleep(1) | ||
print_info() | ||
|
||
# create fontman home directory | ||
print("creating fontman directory... :-)") | ||
home_dir = expanduser('~/') | ||
fontman_dir = home_dir + 'applications/fontman' | ||
o.make_directory(fontman_dir) | ||
|
||
# determine system architecture and download artifacts and extract | ||
print("make sure you have connected to the internet... :-)") | ||
|
||
if '64bit' in arch: | ||
print("downloading fontman artifacts for darwin x86_64") | ||
o.download_file(base_url + fms_darwin_64) | ||
o.download_file(base_url + gui_darwin_64) | ||
|
||
print("extracting...") | ||
o.extract_archive(fms_darwin_64, fontman_dir) | ||
o.extract_archive(gui_darwin_64, fontman_dir) | ||
|
||
else: | ||
print("downloading fontman artifacts for darwin x86") | ||
o.download_file(base_url + fms_darwin_86) | ||
o.download_file(base_url + gui_darwin_86) | ||
|
||
print("extracting...") | ||
o.extract_archive(fms_darwin_86, fontman_dir) | ||
o.extract_archive(gui_darwin_86, fontman_dir) | ||
|
||
# change mode of artifacts to execute mode | ||
o.execute_mode(fontman_dir + "/fms") | ||
|
||
# initializing fontman data | ||
print("initializing fontman data...") | ||
os.system("cd " + fontman_dir + " && ./fms init") | ||
|
||
print("starting fontman :-)") | ||
os.system( | ||
"nohup "+ fontman_dir + "/fms start &> " + fontman_dir+ "/fms.log &" | ||
) | ||
os.system(fontman_dir + "/fontman-gui") | ||
|
||
print("\n\nall done ^_^\n you can now close this window.") | ||
|
||
|
||
if __name__ == '__main__': | ||
install() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
""" windows installer | ||
Install fontman on Windows platforms | ||
""" | ||
|
||
import os, time, winshell | ||
from os.path import expanduser | ||
from win32com.client import Dispatch | ||
|
||
from Operation import Operation | ||
from artifacts import base_url, fms_win_32, fms_win_86, gui_win_32,\ | ||
gui_win_86, version | ||
from install import arch, print_info | ||
|
||
|
||
def install(): | ||
o = Operation() | ||
time.sleep(1) | ||
print_info() | ||
|
||
# create fontman home directory | ||
print("creating fontman directory... :-)") | ||
home_dir = expanduser('~/AppData\\Local') | ||
fontman_dir = home_dir + '\\Fontman' | ||
temp_dir = fontman_dir + '\\temp' | ||
|
||
o.make_directory(fontman_dir) | ||
o.make_directory(temp_dir) | ||
|
||
# determine system architecture and download artifacts and extract | ||
print("make sure you have connected to the internet... :-)") | ||
|
||
if '64bit' in arch: | ||
print("downloading fontman artifacts for Windows x86_64") | ||
o.download_file(base_url + fms_win_32, temp_dir) | ||
o.download_file(base_url + gui_win_32, temp_dir) | ||
|
||
print("extracting...") | ||
o.extract_archive(temp_dir + "\\" + fms_win_32, fontman_dir) | ||
o.extract_archive(temp_dir + "\\" + gui_win_32, fontman_dir) | ||
|
||
else: | ||
print("downloading fontman artifacts for Windows x86") | ||
o.download_file(base_url + fms_win_86, temp_dir) | ||
o.download_file(base_url + gui_win_86, temp_dir) | ||
|
||
print("extracting...") | ||
o.extract_archive(temp_dir + "\\" + fms_win_86, fontman_dir) | ||
o.extract_archive(temp_dir + "\\" + gui_win_86, fontman_dir) | ||
|
||
# copy fontman assets | ||
o.copy_file("assets/fontman.ico", fontman_dir) | ||
o.copy_file("assets/run.bat", fontman_dir) | ||
|
||
# initializing fontman data | ||
print("initializing fontman data...") | ||
os.system("cd " + fontman_dir + " && fms.exe init") | ||
|
||
# creating shortcut | ||
desktop = winshell.desktop() | ||
path = os.path.join(desktop, "Fontman.lnk") | ||
target = fontman_dir + "\\run.bat" | ||
wDir = fontman_dir | ||
icon = fontman_dir + "\\fontman.ico" | ||
|
||
shell = Dispatch('WScript.Shell') | ||
shortcut = shell.CreateShortCut(path) | ||
shortcut.Targetpath = target | ||
shortcut.WorkingDirectory = wDir | ||
shortcut.IconLocation = icon | ||
shortcut.save() | ||
|
||
print("\n\nall done ^_^\n you can now close this window.") | ||
|
||
if __name__ == '__main__': | ||
install() |
This file was deleted.
Oops, something went wrong.