mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
A bit more work
This commit is contained in:
parent
60c8a45dd6
commit
1bc9a8ef20
@ -19,10 +19,14 @@ class InstallerMaker:
|
|||||||
self.shortname = shortname
|
self.shortname = shortname
|
||||||
self.fullname = fullname
|
self.fullname = fullname
|
||||||
self.p3dfile = p3dfile
|
self.p3dfile = p3dfile
|
||||||
self.__makeNSIS()
|
self.version = "1"
|
||||||
self.__makeDEB()
|
|
||||||
|
|
||||||
def __makeDEB(self):
|
def build(self):
|
||||||
|
""" Creates the installer. Call this after you have set all the parameters. """
|
||||||
|
self.__buildDEB()
|
||||||
|
self.__buildNSIS()
|
||||||
|
|
||||||
|
def __buildDEB(self):
|
||||||
InstallerMaker.notify.info("Creating %s.deb..." % self.shortname)
|
InstallerMaker.notify.info("Creating %s.deb..." % self.shortname)
|
||||||
|
|
||||||
# Create a temporary directory and write the control file + launcher to it
|
# Create a temporary directory and write the control file + launcher to it
|
||||||
@ -31,7 +35,7 @@ class InstallerMaker:
|
|||||||
tempdir = tempdir.toOsSpecific()
|
tempdir = tempdir.toOsSpecific()
|
||||||
controlfile = open(os.path.join(tempdir, "control"), "w")
|
controlfile = open(os.path.join(tempdir, "control"), "w")
|
||||||
controlfile.write("Package: %s\n" % self.shortname)
|
controlfile.write("Package: %s\n" % self.shortname)
|
||||||
controlfile.write("Version: 1\n")
|
controlfile.write("Version: %s\n" % self.version)
|
||||||
controlfile.write("Section: games\n")
|
controlfile.write("Section: games\n")
|
||||||
controlfile.write("Priority: optional\n")
|
controlfile.write("Priority: optional\n")
|
||||||
controlfile.write("Architecture: all\n")
|
controlfile.write("Architecture: all\n")
|
||||||
@ -63,11 +67,13 @@ class InstallerMaker:
|
|||||||
# Open the deb file and write to it. It's actually
|
# Open the deb file and write to it. It's actually
|
||||||
# just an AR file, which is very easy to make.
|
# just an AR file, which is very easy to make.
|
||||||
modtime = str(int(time.time())).ljust(11)
|
modtime = str(int(time.time())).ljust(11)
|
||||||
|
if os.path.isfile(self.shortname + ".deb"):
|
||||||
|
os.remove(self.shortname + ".deb")
|
||||||
debfile = open(self.shortname + ".deb", "wb")
|
debfile = open(self.shortname + ".deb", "wb")
|
||||||
debfile.write("!<arch>\x0A")
|
debfile.write("!<arch>\x0A")
|
||||||
debfile.write("debian-binary %s 0 0 100644 4 \x60\x0A" % modtime)
|
debfile.write("debian-binary %s 0 0 100644 4 \x60\x0A" % modtime)
|
||||||
debfile.write("2.0\x0A")
|
debfile.write("2.0\x0A")
|
||||||
debfile.write("control.tar.gz %s 0 0 100644 %s \x60\x0A" % (modtime, str(len(controltargz.str)-1).ljust(9)))
|
debfile.write("control.tar.gz %s 0 0 100644 %s \x60\x0A" % (modtime, str(len(controltargz.str)).ljust(9)))
|
||||||
debfile.write(controltargz.str)
|
debfile.write(controltargz.str)
|
||||||
debfile.write("data.tar.gz %s 0 0 100644 %s \x60\x0A" % (modtime, str(os.path.getsize(os.path.join(tempdir, "data.tar.gz"))).ljust(9)))
|
debfile.write("data.tar.gz %s 0 0 100644 %s \x60\x0A" % (modtime, str(os.path.getsize(os.path.join(tempdir, "data.tar.gz"))).ljust(9)))
|
||||||
|
|
||||||
@ -79,8 +85,9 @@ class InstallerMaker:
|
|||||||
data = datatargz.read(1024 * 1024)
|
data = datatargz.read(1024 * 1024)
|
||||||
datatargz.close()
|
datatargz.close()
|
||||||
debfile.close()
|
debfile.close()
|
||||||
|
shutil.rmtree(tempdir)
|
||||||
|
|
||||||
def __makeNSIS(self):
|
def __buildNSIS(self):
|
||||||
# Check if we have makensis first
|
# Check if we have makensis first
|
||||||
makensis = None
|
makensis = None
|
||||||
if (sys.platform.startswith("win")):
|
if (sys.platform.startswith("win")):
|
||||||
@ -162,5 +169,15 @@ class InstallerMaker:
|
|||||||
nsi.write('SectionEnd')
|
nsi.write('SectionEnd')
|
||||||
nsi.close()
|
nsi.close()
|
||||||
|
|
||||||
os.system(makensis + " " + tempfile)
|
options = ["V2"]
|
||||||
|
cmd = makensis
|
||||||
|
for o in options:
|
||||||
|
if sys.platform.startswith("win"):
|
||||||
|
cmd += " /" + o
|
||||||
|
else:
|
||||||
|
cmd += " -" + o
|
||||||
|
cmd += " " + tempfile
|
||||||
|
os.system(cmd)
|
||||||
|
|
||||||
|
os.remove(tempfile)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user