rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
picw = self.pic.size().width()
picSize = self.pic.size() picw, pich = picSize.width(), picSize.height()
def resizeEvent(self, event): super(MdiTable, self).resizeEvent(event) #return size = self.contentsRect().size()
child = MdiTable()
child = MdiTable(self)
def createMdiChild(self): child = MdiTable() self.mdiArea.addSubWindow(child) child.show() child.shownInit() return child
return i("empty","")
return "offline"
def dz_wifi(): r = wifi_online() if r: if r[0]==0: return i("net_wired","green")+"^fg(white) "+r[1] if r[0]==1: return i("wifi_02","green")+"^fg(white) "+r[1] else: return i("empty","")
mail_dir="~/mail"
mail_dir=home_dir+"/mail"
def new_mail(): mail_dir="~/mail" def count_instances(rex,mailbox): return int(cmd([["grep",rex,mail_dir+"/"+mailbox],["wc","-l"]]).strip()) mailboxes={} for mailbox in [f for f in os.listdir(mail_dir) if "IN-" in f]: mailboxes[mailbox] = \ count_instances("^From:",mailbox) \ - count_instances("^Status:",mailbox) return mailboxes
numfiles = len(os.listdir("~/downloaded")) movedfiles = len([f for f in os.listdir("~/downloaded") if re.match(r'.*\.moved$',f)])
numfiles = len(os.listdir(home_dir+"/downloaded")) movedfiles = len([f for f in os.listdir(home_dir+"/downloaded") if re.match(r'.*\.moved$',f)])
def dz_downloaded(): numfiles = len(os.listdir("~/downloaded")) movedfiles = len([f for f in os.listdir("~/downloaded") if re.match(r'.*\.moved$',f)]) if numfiles > 0: if numfiles < 10: color = "blue" else: color = "red" return i("diskette",color)+" "+str(numfiles-movedfiles)+"/"+str(numfiles) else: if movedfiles == 0: return i("diskette","") else: return i("diskette","white")
raw = cmd([["iwconfig"],["grep","-io","essid:\".*\""]]).strip() rex = re.compile(r'ESSID:"(.*)"') m = rex.search(raw) if m: return rex.search(raw).groups()[0] else: return ""
nic="eth0" wifi="wlan0" rex = re.compile(r'inet addr:(.*)') raw_nic = cmd([["ifconfig",nic],["grep","-io","inet addr:[0-9\\.]\+"]]).strip() raw_wifi = cmd([["ifconfig",wifi],["grep","-io","inet addr:[0-9\\.]\+"]]).strip() m_nic = rex.search(raw_nic) m_wifi = rex.search(raw_wifi) if m_nic: return (0,m_nic.groups()[0]) if m_wifi: return (1,m_wifi.groups()[0]) if not (m_nic or m_wifi): return None
def wifi_online(): raw = cmd([["iwconfig"],["grep","-io","essid:\".*\""]]).strip() rex = re.compile(r'ESSID:"(.*)"') m = rex.search(raw) if m: return rex.search(raw).groups()[0] else: return ""
if r: return i("wifi_02","green")+"^fg(white) "+r else: return i("wifi_02","")
if r: if r[0]==0: return i("net_wired","green")+"^fg(white) "+r[1] if r[0]==1: return i("wifi_02","green")+"^fg(white) "+r[1] else: return i("empty","")
def dz_wifi(): r = wifi_online() if r: return i("wifi_02","green")+"^fg(white) "+r else: return i("wifi_02","")
if self.isstatic and not self.idfilts[id].hasStaticValueSet(): self.isstatic = False
def __init__(self, datasetType=None, ids=None, **kw): """ @param datasetType the type of dataset to look for. This can either be a single type name or list of names @param ids a dictionary mapping identifier names to IDFilter instances @param * additional named parameters are taken as identifiers to be set with the given values """ if datasetType is not None and not isinstance(datasetType, list): datasetType = [datasetType] self.dataTypes = datasetType if self.dataTypes is not None: self.isstatic = True
root = self.logger
root = self.log
def tagLogger(self, jobid): idstr = [] if not jobid: # clear out the previous info if self.jobid: for key in self.jobid.keys(): self._resetLogJobId(self.jobid, key) else: self.jobid = {} jobid = self.jobid idstr.append("unknown") else: self.jobid = jobid for key in self.jobid.keys(): idstr.append("%s=%s" % (key, str(jobid[key])))
template = len(outputs > 0) and outputs[0] or inputs[0]
template = len(outputs) > 0 and outputs[0] or inputs[0]
def _determineJobIdentity(self, outputs, inputs=None): # determine the job identity if inputs is None: inputs = [] if self.jobIdConf: # determine our template dataset for our identity template = None if self.jobIdConf.exists("templateType"): # find first dataset (in output, then input) matching # this dataset type. type = self.jobIdConf.getString("templateType") selecttype = lambda d: d.type == type template = filter(selecttype, outputs) if len(template) == 0: template = filter(selecttype, inputs) if len(template) > 0: template = template[0] if not template: # default to the first output (then input) dataset template = len(outputs > 0) and outputs[0] or inputs[0]
root = Log.getDefaultLog()
root = self.logger
def tagLogger(self, jobid): idstr = [] if not jobid: # clear out the previous info if self.jobid: for key in self.jobid.keys(): self._resetLogJobId(self.jobid, key) else: self.jobid = {} jobid = self.jobid idstr.append("unknown") else: self.jobid = jobid for key in self.jobid.keys(): idstr.append("%s=%s" % (key, str(jobid[key])))
if any(self.range) and any(filter(lambda r: r is None, self.range)):
if len(filter(lambda r: r is not None, self.range)) > 0 and \ len(filter(lambda r: r is None, self.range)) > 0:
def __init__(self, name, min=None, lim=None, values=None, isstaticset=True): """ create the filter @param min the minimum identifier value recognized @param lim one more than the maximum identifier value recognized @param values an arbitrary list of identifier values recognized. These may be listed in addition to or instead of a range. @param isstaticset a flag indicating whether these parameters should be considered a closed, static set of identifiers. While by default this is set to True, it will be internally made False if one and only of min and lim are specified. """ IDFilter.__init__(self, name, fromSubclass=True) self.isstatic = isstaticset self.range = (min, lim) self.values = None if values is not None: if not isinstance(values, list): values = [values] if len(filter(lambda v: not isinstance(v,int), values)) > 0: raise ValueError("IntegerIDFilter: non-integer value given for values: " + str(self.values)) self.values = list(values)
if any(self.range) and any(filter(lambda r: r is None, self.range)):
if len(filter(lambda r: r is not None, self.range)) > 0 and \ len(filter(lambda r: r is None, self.range)) > 0:
def allowedValues(self): """ return a list representing the complete set of values that will be returned by recognize() (except None). This may raise an exception if hasStaticValueSet() returns False. """ if any(self.range) and any(filter(lambda r: r is None, self.range)): raise RuntimeError("identifier set (%s) is not closed" % self.name)
template = len(output > 0) and outputs[0] or inputs[0]
template = len(outputs > 0) and outputs[0] or inputs[0]
def _determineJobIdentity(self, outputs, inputs=None): # determine the job identity if inputs is None: inputs = [] if self.jobIdConf: # determine our template dataset for our identity template = None if self.jobIdConf.exists("templateType"): # find first dataset (in output, then input) matching # this dataset type. type = self.jobIdConf.getString("templateType") selecttype = lambda d: d.type == type template = filter(selecttype, outputs) if len(template) == 0: template = filter(selecttype, inputs) if len(template) > 0: template = template[0] if not template: # default to the first output (then input) dataset template = len(output > 0) and outputs[0] or inputs[0]
self.tagLogger(jobid)
self.tagLogger(jobid.copy())
def setAssignment(self, clipboard): self.client.tellReady() self.log.log(Log.INFO-2, "Told JobOffice, I'm ready!") jobid, inputs, outputs = self.client.getAssignment() if jobid is None: raise RuntimeError("empty assignment from JobOffice (event timed out?)") self.log.log(Log.INFO-2, "Received assignment") clipboard.put("originatorId", self.client.getOriginatorId()) clipboard.put(self.clipboardKeys["inputDatasets"], inputs) clipboard.put(self.clipboardKeys["outputDatasets"], outputs) clipboard.put(self.clipboardKeys["completedDatasets"], []) clipboard.put(self.clipboardKeys["jobIdentity"], jobid) self.tagLogger(jobid) self.log.log(Log.INFO, "Processing job: " + self.jobidStr)
return min([s.size for s in self.snapshots])
return min(self.snapshots, key=snapshot_size)
def minimum(self): return min([s.size for s in self.snapshots])
return max([s.size for s in self.snapshots])
return max(self.snapshots, key=snapshot_size)
def maximum(self): return max([s.size for s in self.snapshots])
return min(self.snapshots, key=snapshot_size)
snapshots = self.snapshots snapshots.sort(key=snapshot_size) return snapshots[0]
def minimum(self): return min(self.snapshots, key=snapshot_size)
return max(self.snapshots, key=snapshot_size)
snapshots = self.snapshots snapshots.sort(key=snapshot_size) return snapshots[-1]
def maximum(self): return max(self.snapshots, key=snapshot_size)
cli.add_option('-a', '--archive', dest='archive', default='text', metavar="DIR",
cli.add_option('-a', '--archive', dest='archive', action='store_true', metavar="DIR",
def projects(self): projects = [] for entry in os.listdir(self.path): entry_path = os.path.join(self.path, entry)
return min([s for s in self.snapshots])
return min([s.size for s in self.snapshots])
def minimum(self): return min([s for s in self.snapshots])
return max([s for s in self.snapshots])
return max([s.size for s in self.snapshots])
def maximum(self): return max([s for s in self.snapshots])
self.timestamp = m.group('year')
self.timestamp = int(m.group('timestamp'))
def __init__(self, path): self.path = path self.id = os.path.basename(path)
msg = u"HTTP/1.0 200 OK\r\nContent-Type: %s" % contentType
msg = "HTTP/1.0 200 OK\r\nContent-Type: %s" % contentType
def respondCustom(self,contentType,body): msg = u"HTTP/1.0 200 OK\r\nContent-Type: %s" % contentType
msg += u"\r\n\r\n%s" % (body)
msg += "\r\n\r\n%s" % (body)
def respondCustom(self,contentType,body): msg = u"HTTP/1.0 200 OK\r\nContent-Type: %s" % contentType
if cls.sys.platform == "win32": filename += "_d"
def __prepare(cls): # This method only needs to be called once. if cls.prepared: return cls.prepared = True # First, we must ensure that the library path is # modified to locate all of the dynamic libraries. target = None filename = "libpandaexpress" + cls.dll_suffix if cls.sys.platform == "win32": filename += "_d" for dir in cls.sys.path + [cls.sys.prefix]: lib = cls.os.path.join(dir, filename) for dll_ext in cls.dll_exts: if (cls.os.path.exists(lib + dll_ext)): target = dir break if target == None: raise ImportError, "Cannot find %s" % (filename) target = cls.os.path.abspath(target)
handle = os.popen(LocateBinary("ldconfig") + " -NXp")
if (sys.platform.startswith("freebsd")): handle = os.popen(LocateBinary("ldconfig")) else: handle = os.popen(LocateBinary("ldconfig") + " -NXp")
def GetLibCache(): # Returns a list of cached libraries, not prefixed by lib and not suffixed by .so* or .a! global LD_CACHE if (LD_CACHE == None): LD_CACHE = [] print "Generating library cache..." if (LocateBinary("ldconfig") != None): handle = os.popen(LocateBinary("ldconfig") + " -NXp") result = handle.read().strip().split("\n") for line in result: lib = line.strip().split(" ", 1)[0] if (".so " in lib): lib = lib.split(".so", 1)[0][3:] LD_CACHE.append(lib) libs = glob.glob("/lib/*.so") + glob.glob("/usr/lib/*.so") + glob.glob("/usr/local/lib/*.so") + glob.glob("/usr/PCBSD/local/lib/*.so") libs += glob.glob("/lib/*.a") + glob.glob("/usr/lib/*.a") + glob.glob("/usr/local/lib/*.a") + glob.glob("/usr/PCBSD/local/lib/*.a") if platform.architecture()[0] == "64bit": libs += glob.glob("/lib64/*.so") + glob.glob("/usr/lib64/*.so") libs += glob.glob("/lib64/*.a") + glob.glob("/usr/lib64/*.a") if (sys.platform == "darwin"): libs += glob.glob("/lib/*.dylib*") + glob.glob("/usr/lib/*.dylib*") + glob.glob("/usr/local/lib/*.dylib*") libs += glob.glob("/usr/X11/lib/*.dylib*") + glob.glob("/usr/X11R6/lib/*.dylib*") libs += glob.glob("/lib/*.a") + glob.glob("/usr/lib/*.a") + glob.glob("/usr/local/lib/*.a") libs += glob.glob("/usr/X11/lib/*.a") + glob.glob("/usr/X11R6/lib/*.a") for l in libs: lib = os.path.basename(l).split(".so", 1)[0].split(".a", 1)[0].split(".dylib", 1)[0][3:] if lib not in LD_CACHE: LD_CACHE.append(lib) return LD_CACHE
PPATH=get_python_lib(1) PEXEC=os.path.join(os.path.dirname(sys.executable), os.readlink(sys.executable))
PPATH = get_python_lib(1) if os.path.islink(sys.executable): PEXEC = os.path.join(os.path.dirname(sys.executable), os.readlink(sys.executable)) else: PEXEC = sys.executable
def InstallPanda(destdir="", prefix="/usr", outputdir="built"): if (not prefix.startswith("/")): prefix = "/" + prefix PPATH=get_python_lib(1) PEXEC=os.path.join(os.path.dirname(sys.executable), os.readlink(sys.executable)) oscmd("mkdir -p "+destdir+prefix+"/bin") oscmd("mkdir -p "+destdir+prefix+"/include") oscmd("mkdir -p "+destdir+prefix+"/share/panda3d") oscmd("mkdir -p "+destdir+prefix+"/share/panda3d/direct") oscmd("mkdir -p "+destdir+prefix+"/share/mime-info") oscmd("mkdir -p "+destdir+prefix+"/share/mime/packages") oscmd("mkdir -p "+destdir+prefix+"/share/application-registry") oscmd("mkdir -p "+destdir+prefix+"/share/applications") oscmd("mkdir -p "+destdir+prefix+libdir+"/panda3d") oscmd("mkdir -p "+destdir+PPATH) oscmd("mkdir -p "+destdir+"/etc/ld.so.conf.d") WriteFile(destdir+prefix+"/share/panda3d/direct/__init__.py", "") Configrc = ReadFile(outputdir+"/etc/Config.prc") Configrc = Configrc.replace("model-path $THIS_PRC_DIR/..", "model-path "+prefix+"/share/panda3d") WriteFile(destdir+"/etc/Config.prc", Configrc) oscmd("cp "+outputdir+"/etc/Confauto.prc "+destdir+"/etc/Confauto.prc") oscmd("cp -R "+outputdir+"/include "+destdir+prefix+"/include/panda3d") oscmd("cp -R direct/src/* "+destdir+prefix+"/share/panda3d/direct") oscmd("cp -R "+outputdir+"/pandac "+destdir+prefix+"/share/panda3d/pandac") oscmd("cp -R "+outputdir+"/models "+destdir+prefix+"/share/panda3d/models") oscmd("cp direct/src/ffi/panda3d.py "+destdir+prefix+"/share/panda3d/panda3d.py") if os.path.isdir("samples"): oscmd("cp -R samples "+destdir+prefix+"/share/panda3d/samples") if os.path.isdir(outputdir+"/Pmw"): oscmd("cp -R "+outputdir+"/Pmw "+destdir+prefix+"/share/panda3d/Pmw") if os.path.isdir(outputdir+"/plugins"): oscmd("cp -R "+outputdir+"/plugins "+destdir+prefix+"/share/panda3d/plugins") WriteMimeFile(destdir+prefix+"/share/mime-info/panda3d.mime", MIME_INFO) WriteKeysFile(destdir+prefix+"/share/mime-info/panda3d.keys", MIME_INFO) WriteMimeXMLFile(destdir+prefix+"/share/mime/packages/panda3d.xml", MIME_INFO) WriteApplicationsFile(destdir+prefix+"/share/application-registry/panda3d.applications", APP_INFO, MIME_INFO) oscmd("cp makepanda/pview.desktop "+destdir+prefix+"/share/applications/pview.desktop") oscmd("cp doc/LICENSE "+destdir+prefix+"/share/panda3d/LICENSE") oscmd("cp doc/LICENSE "+destdir+prefix+"/include/panda3d/LICENSE") oscmd("cp doc/ReleaseNotes "+destdir+prefix+"/share/panda3d/ReleaseNotes") oscmd("echo '"+prefix+libdir+"/panda3d'> "+destdir+"/etc/ld.so.conf.d/panda3d.conf") oscmd("echo '"+prefix+"/share/panda3d' > "+destdir+PPATH+"/panda3d.pth") oscmd("echo '"+prefix+libdir+"/panda3d'>> "+destdir+PPATH+"/panda3d.pth") oscmd("chmod +x "+destdir+"/etc/ld.so.conf.d/panda3d.conf") oscmd("ln -s "+PEXEC+" "+destdir+prefix+"/bin/ppython") oscmd("cp "+outputdir+"/bin/* "+destdir+prefix+"/bin/") for base in os.listdir(outputdir+"/lib"): if (not base.endswith(".a")): oscmd("cp -d "+outputdir+"/lib/"+base+" "+destdir+prefix+libdir+"/panda3d/"+base) # rpmlint doesn't like it if we compile pyc. #for base in os.listdir(destdir+prefix+"/share/panda3d/direct"): # if ((base != "extensions") and (base != "extensions_native")): # compileall.compile_dir(destdir+prefix+"/share/panda3d/direct/"+base) #compileall.compile_dir(destdir+prefix+"/share/panda3d/Pmw") DeleteCVS(destdir+prefix+"/include/panda3d") DeleteCVS(destdir+prefix+"/share/panda3d") # rpmlint doesn't like these files, for some reason. DeleteBuildFiles(destdir+prefix+"/share/panda3d") if (os.path.isfile(destdir+prefix+"/share/panda3d/direct/leveleditor/copyfiles.pl")): os.remove(destdir+prefix+"/share/panda3d/direct/leveleditor/copyfiles.pl")
if hasattr(objDef, 'animDict'):
if hasattr(objDef, 'animDict') and objDef.animDict != {}:
def addNewObject(self, typeName, uid = None, model = None, parent=None, anim = None, fSelectObject=True, nodePath=None, nameStr=None): """ function to add new obj to the scene """ if parent is None: parent = self.editor.NPParent
menuItem = self.menuEdit.Append(-1, "&Rndo")
menuItem = self.menuEdit.Append(-1, "&Redo")
def createMenu(self): menuItem = self.menuFile.Insert(0, -1 , "&New") self.Bind(wx.EVT_MENU, self.onNew, menuItem) menuItem = self.menuFile.Insert(1, -1 , "&Load") self.Bind(wx.EVT_MENU, self.onLoad, menuItem)
if (RUNTIME or RTDIST): OPTS=['DIR:direct/src/plugin_standalone', 'RUNTIME', 'TINYXML', 'OPENSSL'] TargetAdd('plugin_standalone_panda3dBase.obj', opts=OPTS, input='panda3dBase.cxx')
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
widget.setPosHpr(state.base, state.pos, state.hpr) else: base.direct.widget.setPosHpr(state.base, state.pos, state.hpr)
if self.worldSpaceManip: widget.setPos(state.base, state.pos) widget.setHpr(render, VBase3(0)) else: widget.setPosHpr(state.base, state.pos, state.hpr) else: if self.worldSpaceManip: widget.setPos(state.base, state.pos) widget.setHpr(render, VBase3(0)) else: base.direct.widget.setPosHpr(state.base, state.pos, state.hpr)
def followSelectedNodePathTask(self, state): if hasattr(base.direct, "manipulationControl") and base.direct.manipulationControl.fMultiView: for widget in base.direct.manipulationControl.widgetList: widget.setPosHpr(state.base, state.pos, state.hpr) else: base.direct.widget.setPosHpr(state.base, state.pos, state.hpr) return Task.cont
if base.direct.fControl and not self.currEditTypes & EDIT_TYPE_UNSCALABLE: if type == 'post': self.fScaling1D = 1 self.scale1D(state) else: self.fScaling3D = 1 self.scale3D(state) else:
if self.useSeparateScaleHandles:
def manipulateObjectTask(self, state): if self.fScaling1D: self.scale1D(state) elif self.fScaling3D: self.scale3D(state) else: # Widget takes precedence if self.constraint: type = self.constraint[2:] if base.direct.fControl and not self.currEditTypes & EDIT_TYPE_UNSCALABLE: if type == 'post': # [gjeon] non-uniform scaling self.fScaling1D = 1 self.scale1D(state) else: # [gjeon] uniform scaling self.fScaling3D = 1 self.scale3D(state) else: if type == 'post' and not self.currEditTypes & EDIT_TYPE_UNMOVABLE: self.xlate1D(state) elif type == 'disc' and not self.currEditTypes & EDIT_TYPE_UNMOVABLE: self.xlate2D(state) elif type == 'ring' and not self.currEditTypes & EDIT_TYPE_UNROTATABLE: self.rotate1D(state) # No widget interaction, determine free manip mode elif self.fFreeManip: # If we've been scaling and changed modes, reset object handles if 0 and (self.fScaling1D or self.fScaling3D) and (not base.direct.fAlt): if hasattr(base.direct, 'widget'): base.direct.widget.transferObjectHandleScale() else: self.objectHandles.transferObjectHandlesScale()
elif self.fFreeManip:
elif self.fFreeManip and not self.useSeparateScaleHandles:
def manipulateObjectTask(self, state): if self.fScaling1D: self.scale1D(state) elif self.fScaling3D: self.scale3D(state) else: # Widget takes precedence if self.constraint: type = self.constraint[2:] if base.direct.fControl and not self.currEditTypes & EDIT_TYPE_UNSCALABLE: if type == 'post': # [gjeon] non-uniform scaling self.fScaling1D = 1 self.scale1D(state) else: # [gjeon] uniform scaling self.fScaling3D = 1 self.scale3D(state) else: if type == 'post' and not self.currEditTypes & EDIT_TYPE_UNMOVABLE: self.xlate1D(state) elif type == 'disc' and not self.currEditTypes & EDIT_TYPE_UNMOVABLE: self.xlate2D(state) elif type == 'ring' and not self.currEditTypes & EDIT_TYPE_UNROTATABLE: self.rotate1D(state) # No widget interaction, determine free manip mode elif self.fFreeManip: # If we've been scaling and changed modes, reset object handles if 0 and (self.fScaling1D or self.fScaling3D) and (not base.direct.fAlt): if hasattr(base.direct, 'widget'): base.direct.widget.transferObjectHandleScale() else: self.objectHandles.transferObjectHandlesScale()
if base.direct.camera.getName() != 'persp': self.prevHit.assign(self.hitPt)
def xlate1D(self, state): # Constrained 1D Translation along widget axis # Compute nearest hit point along axis and try to keep # that point as close to the current mouse position as possible # what point on the axis is the mouse pointing at? self.hitPt.assign(self.objectHandles.getAxisIntersectPt( self.constraint[:1])) # use it to see how far to move the widget if self.fHitInit: # First time through, just record that point self.fHitInit = 0 self.prevHit.assign(self.hitPt) else: # Move widget to keep hit point as close to mouse as possible offset = self.hitPt - self.prevHit
print self.constraint
def scale1D(self, state): print self.constraint if hasattr(base.direct, "manipulationControl") and base.direct.manipulationControl.fMultiView: self.hitPtScale.assign(self.objectHandles.getMouseIntersectPt())
self.hitPtScale.assign(self.objectHandles.getMouseIntersectPt())
self.hitPtScale.assign(self.objectHandles.getAxisIntersectPt(self.constraint[:1])) self.hitPtScale = self.objectHandles.getMat().xformVec(self.hitPtScale)
def scale1D(self, state): print self.constraint if hasattr(base.direct, "manipulationControl") and base.direct.manipulationControl.fMultiView: self.hitPtScale.assign(self.objectHandles.getMouseIntersectPt())
d0 = (self.prevHitScale - widgetPos).length() d1 = (self.hitPtScale - widgetPos).length() offset = d1 - d0 currScale = base.direct.widget.getScale()
d0 = (self.prevHitScale).length() if d0 == 0: d0 = 0.001 d1 = (self.hitPtScale).length() if d1 == 0: d1 = 0.001 currScale = self.origScale
def scale1D(self, state): print self.constraint if hasattr(base.direct, "manipulationControl") and base.direct.manipulationControl.fMultiView: self.hitPtScale.assign(self.objectHandles.getMouseIntersectPt())
currScale = Vec3(currScale.getX() + offset, currScale.getY(), currScale.getZ()) if currScale.getX() < 0.0: currScale.setX(0.01)
currScale = Vec3(currScale.getX() * d1/d0, currScale.getY(), currScale.getZ())
def scale1D(self, state): print self.constraint if hasattr(base.direct, "manipulationControl") and base.direct.manipulationControl.fMultiView: self.hitPtScale.assign(self.objectHandles.getMouseIntersectPt())
currScale = Vec3(currScale.getX(), currScale.getY() + offset, currScale.getZ()) if currScale.getY() < 0.0: currScale.setY(0.01)
currScale = Vec3(currScale.getX(), currScale.getY() * d1/d0, currScale.getZ())
def scale1D(self, state): print self.constraint if hasattr(base.direct, "manipulationControl") and base.direct.manipulationControl.fMultiView: self.hitPtScale.assign(self.objectHandles.getMouseIntersectPt())
currScale = Vec3(currScale.getX(), currScale.getY(), currScale.getZ() + offset) if currScale.getZ() < 0.0: currScale.setZ(0.01)
currScale = Vec3(currScale.getX(), currScale.getY(), currScale.getZ() * d1/d0)
def scale1D(self, state): print self.constraint if hasattr(base.direct, "manipulationControl") and base.direct.manipulationControl.fMultiView: self.hitPtScale.assign(self.objectHandles.getMouseIntersectPt())
self.prevHitScale.assign(self.hitPtScale)
def scale1D(self, state): print self.constraint if hasattr(base.direct, "manipulationControl") and base.direct.manipulationControl.fMultiView: self.hitPtScale.assign(self.objectHandles.getMouseIntersectPt())
self.hitPtScale.assign(self.objectHandles.getMouseIntersectPt()) if self.fScaleInit1: self.fScaleInit1 = 0 self.prevHitScale.assign(self.hitPtScale) else: widgetPos = base.direct.widget.getPos() d0 = (self.prevHitScale - widgetPos).length() d1 = (self.hitPtScale - widgetPos).length() offset = d1 - d0 currScale = base.direct.widget.getScale() currScale += offset if currScale.getX() < 0.0 and\ currScale.getY() < 0.0 and\ currScale.getZ() < 0.0: currScale = VBase3(0.01, 0.01, 0.01) base.direct.widget.setScale(currScale) self.prevHitScale.assign(self.hitPtScale) return
if self.useSeparateScaleHandles: self.hitPtScale.assign(self.objectHandles.getAxisIntersectPt(self.constraint[:1])) self.hitPtScale = self.objectHandles.getMat().xformVec(self.hitPtScale) if self.fScaleInit1: self.fScaleInit1 = 0 self.prevHitScale.assign(self.hitPtScale) self.origScale = base.direct.widget.getScale() else: widgetPos = base.direct.widget.getPos() d0 = (self.prevHitScale).length() if d0 == 0: d0 = 0.001 d1 = (self.hitPtScale).length() if d1 == 0: d1 = 0.001 currScale = self.origScale currScale = Vec3(currScale.getX() * d1/d0, currScale.getY() * d1/d0, currScale.getZ() * d1/d0) base.direct.widget.setScale(currScale) return else: self.hitPtScale.assign(self.objectHandles.getMouseIntersectPt()) if self.fScaleInit1: self.fScaleInit1 = 0 self.prevHitScale.assign(self.hitPtScale) self.origScale = base.direct.widget.getScale() else: widgetPos = base.direct.widget.getPos() d0 = (self.prevHitScale - widgetPos).length() if d0 == 0: d0 = 0.001 d1 = (self.hitPtScale - widgetPos).length() if d1 == 0: d1 = 0.001 currScale = self.origScale currScale = currScale * d1/d0 base.direct.widget.setScale(currScale) return
def scale3D(self, state): if hasattr(base.direct, "manipulationControl") and base.direct.manipulationControl.fMultiView: self.hitPtScale.assign(self.objectHandles.getMouseIntersectPt())
self.enableHandles(['x-post','x-ring','x-disc'])
self.enableHandles(['x-post','x-ring','x-disc', 'x-scale'])
def enableHandles(self, handles): if type(handles) == types.ListType: for handle in handles: self.enableHandle(handle) elif handles == 'x': self.enableHandles(['x-post','x-ring','x-disc']) elif handles == 'y': self.enableHandles(['y-post','y-ring','y-disc']) elif handles == 'z': self.enableHandles(['z-post','z-ring','z-disc']) elif handles == 'post': self.enableHandles(['x-post','y-post','z-post']) elif handles == 'ring': self.enableHandles(['x-ring','y-ring','z-ring']) elif handles == 'disc': self.enableHandles(['x-disc','y-disc','z-disc']) elif handles == 'all': self.enableHandles(['x-post','x-ring','x-disc', 'y-post','y-ring','y-disc', 'z-post','z-ring','z-disc'])
self.enableHandles(['y-post','y-ring','y-disc'])
self.enableHandles(['y-post','y-ring','y-disc', 'y-scale'])
def enableHandles(self, handles): if type(handles) == types.ListType: for handle in handles: self.enableHandle(handle) elif handles == 'x': self.enableHandles(['x-post','x-ring','x-disc']) elif handles == 'y': self.enableHandles(['y-post','y-ring','y-disc']) elif handles == 'z': self.enableHandles(['z-post','z-ring','z-disc']) elif handles == 'post': self.enableHandles(['x-post','y-post','z-post']) elif handles == 'ring': self.enableHandles(['x-ring','y-ring','z-ring']) elif handles == 'disc': self.enableHandles(['x-disc','y-disc','z-disc']) elif handles == 'all': self.enableHandles(['x-post','x-ring','x-disc', 'y-post','y-ring','y-disc', 'z-post','z-ring','z-disc'])
self.enableHandles(['z-post','z-ring','z-disc'])
self.enableHandles(['z-post','z-ring','z-disc', 'z-scale'])
def enableHandles(self, handles): if type(handles) == types.ListType: for handle in handles: self.enableHandle(handle) elif handles == 'x': self.enableHandles(['x-post','x-ring','x-disc']) elif handles == 'y': self.enableHandles(['y-post','y-ring','y-disc']) elif handles == 'z': self.enableHandles(['z-post','z-ring','z-disc']) elif handles == 'post': self.enableHandles(['x-post','y-post','z-post']) elif handles == 'ring': self.enableHandles(['x-ring','y-ring','z-ring']) elif handles == 'disc': self.enableHandles(['x-disc','y-disc','z-disc']) elif handles == 'all': self.enableHandles(['x-post','x-ring','x-disc', 'y-post','y-ring','y-disc', 'z-post','z-ring','z-disc'])
self.enableHandles(['x-post','x-ring','x-disc', 'y-post','y-ring','y-disc', 'z-post','z-ring','z-disc'])
self.enableHandles(['x-post','x-ring','x-disc','x-scale', 'y-post','y-ring','y-disc','y-scale', 'z-post','z-ring','z-disc','z-scale'])
def enableHandles(self, handles): if type(handles) == types.ListType: for handle in handles: self.enableHandle(handle) elif handles == 'x': self.enableHandles(['x-post','x-ring','x-disc']) elif handles == 'y': self.enableHandles(['y-post','y-ring','y-disc']) elif handles == 'z': self.enableHandles(['z-post','z-ring','z-disc']) elif handles == 'post': self.enableHandles(['x-post','y-post','z-post']) elif handles == 'ring': self.enableHandles(['x-ring','y-ring','z-ring']) elif handles == 'disc': self.enableHandles(['x-disc','y-disc','z-disc']) elif handles == 'all': self.enableHandles(['x-post','x-ring','x-disc', 'y-post','y-ring','y-disc', 'z-post','z-ring','z-disc'])
if handle == 'y-post':
elif handle == 'x-scale' and base.direct.manipulationControl.useSeparateScaleHandles: self.xScaleGroup.reparentTo(self.xHandles) elif handle == 'y-post':
def enableHandle(self, handle): if handle == 'x-post': self.xPostGroup.reparentTo(self.xHandles) elif handle == 'x-ring': self.xRingGroup.reparentTo(self.xHandles) elif handle == 'x-disc': self.xDiscGroup.reparentTo(self.xHandles) if handle == 'y-post': self.yPostGroup.reparentTo(self.yHandles) elif handle == 'y-ring': self.yRingGroup.reparentTo(self.yHandles) elif handle == 'y-disc': self.yDiscGroup.reparentTo(self.yHandles) if handle == 'z-post': self.zPostGroup.reparentTo(self.zHandles) elif handle == 'z-ring': self.zRingGroup.reparentTo(self.zHandles) elif handle == 'z-disc': self.zDiscGroup.reparentTo(self.zHandles)
if handle == 'z-post':
elif handle == 'y-scale' and base.direct.manipulationControl.useSeparateScaleHandles: self.yScaleGroup.reparentTo(self.yHandles) elif handle == 'z-post':
def enableHandle(self, handle): if handle == 'x-post': self.xPostGroup.reparentTo(self.xHandles) elif handle == 'x-ring': self.xRingGroup.reparentTo(self.xHandles) elif handle == 'x-disc': self.xDiscGroup.reparentTo(self.xHandles) if handle == 'y-post': self.yPostGroup.reparentTo(self.yHandles) elif handle == 'y-ring': self.yRingGroup.reparentTo(self.yHandles) elif handle == 'y-disc': self.yDiscGroup.reparentTo(self.yHandles) if handle == 'z-post': self.zPostGroup.reparentTo(self.zHandles) elif handle == 'z-ring': self.zRingGroup.reparentTo(self.zHandles) elif handle == 'z-disc': self.zDiscGroup.reparentTo(self.zHandles)
self.disableHandles(['x-post','x-ring','x-disc'])
self.disableHandles(['x-post','x-ring','x-disc','x-scale'])
def disableHandles(self, handles): if type(handles) == types.ListType: for handle in handles: self.disableHandle(handle) elif handles == 'x': self.disableHandles(['x-post','x-ring','x-disc']) elif handles == 'y': self.disableHandles(['y-post','y-ring','y-disc']) elif handles == 'z': self.disableHandles(['z-post','z-ring','z-disc']) elif handles == 'post': self.disableHandles(['x-post','y-post','z-post']) elif handles == 'ring': self.disableHandles(['x-ring','y-ring','z-ring']) elif handles == 'disc': self.disableHandles(['x-disc','y-disc','z-disc']) elif handles == 'all': self.disableHandles(['x-post','x-ring','x-disc', 'y-post','y-ring','y-disc', 'z-post','z-ring','z-disc'])
self.disableHandles(['y-post','y-ring','y-disc'])
self.disableHandles(['y-post','y-ring','y-disc','y-scale'])
def disableHandles(self, handles): if type(handles) == types.ListType: for handle in handles: self.disableHandle(handle) elif handles == 'x': self.disableHandles(['x-post','x-ring','x-disc']) elif handles == 'y': self.disableHandles(['y-post','y-ring','y-disc']) elif handles == 'z': self.disableHandles(['z-post','z-ring','z-disc']) elif handles == 'post': self.disableHandles(['x-post','y-post','z-post']) elif handles == 'ring': self.disableHandles(['x-ring','y-ring','z-ring']) elif handles == 'disc': self.disableHandles(['x-disc','y-disc','z-disc']) elif handles == 'all': self.disableHandles(['x-post','x-ring','x-disc', 'y-post','y-ring','y-disc', 'z-post','z-ring','z-disc'])
self.disableHandles(['z-post','z-ring','z-disc'])
self.disableHandles(['z-post','z-ring','z-disc','z-scale'])
def disableHandles(self, handles): if type(handles) == types.ListType: for handle in handles: self.disableHandle(handle) elif handles == 'x': self.disableHandles(['x-post','x-ring','x-disc']) elif handles == 'y': self.disableHandles(['y-post','y-ring','y-disc']) elif handles == 'z': self.disableHandles(['z-post','z-ring','z-disc']) elif handles == 'post': self.disableHandles(['x-post','y-post','z-post']) elif handles == 'ring': self.disableHandles(['x-ring','y-ring','z-ring']) elif handles == 'disc': self.disableHandles(['x-disc','y-disc','z-disc']) elif handles == 'all': self.disableHandles(['x-post','x-ring','x-disc', 'y-post','y-ring','y-disc', 'z-post','z-ring','z-disc'])
self.disableHandles(['x-post','x-ring','x-disc', 'y-post','y-ring','y-disc', 'z-post','z-ring','z-disc'])
self.disableHandles(['x-post','x-ring','x-disc','x-scale', 'y-post','y-ring','y-disc','y-scale', 'z-post','z-ring','z-disc','z-scale'])
def disableHandles(self, handles): if type(handles) == types.ListType: for handle in handles: self.disableHandle(handle) elif handles == 'x': self.disableHandles(['x-post','x-ring','x-disc']) elif handles == 'y': self.disableHandles(['y-post','y-ring','y-disc']) elif handles == 'z': self.disableHandles(['z-post','z-ring','z-disc']) elif handles == 'post': self.disableHandles(['x-post','y-post','z-post']) elif handles == 'ring': self.disableHandles(['x-ring','y-ring','z-ring']) elif handles == 'disc': self.disableHandles(['x-disc','y-disc','z-disc']) elif handles == 'all': self.disableHandles(['x-post','x-ring','x-disc', 'y-post','y-ring','y-disc', 'z-post','z-ring','z-disc'])
hitPt = entry.getSurfacePoint(entry.getFromNodePath()) np = NodePath('temp') np.setPos(base.direct.camera, hitPt) self.hitPt.assign(np.getPos()) np.remove()
self.hitPt = entry.getSurfacePoint(self)
def getAxisIntersectPt(self, axis): if hasattr(base.direct, "manipulationControl") and base.direct.manipulationControl.fMultiView and\ base.direct.camera.getName() != 'persp': # create ray from the camera to detect 3d position iRay = SelectionRay(base.direct.camera) iRay.collider.setFromLens(base.direct.camNode, base.direct.dr.mouseX, base.direct.dr.mouseY) #iRay.collideWithBitMask(1) iRay.collideWithBitMask(BitMask32.bit(21)) iRay.ct.traverse(base.direct.grid)
def drawBox(lines, center, sideLength): l = sideLength * 0.5 lines.moveTo(center[0] + l, center[1] + l, center[2] + l) lines.drawTo(center[0] + l, center[1] + l, center[2] - l) lines.drawTo(center[0] + l, center[1] - l, center[2] - l) lines.drawTo(center[0] + l, center[1] - l, center[2] + l) lines.drawTo(center[0] + l, center[1] + l, center[2] + l) lines.moveTo(center[0] - l, center[1] + l, center[2] + l) lines.drawTo(center[0] - l, center[1] + l, center[2] - l) lines.drawTo(center[0] - l, center[1] - l, center[2] - l) lines.drawTo(center[0] - l, center[1] - l, center[2] + l) lines.drawTo(center[0] - l, center[1] + l, center[2] + l) lines.moveTo(center[0] + l, center[1] + l, center[2] + l) lines.drawTo(center[0] + l, center[1] + l, center[2] - l) lines.drawTo(center[0] - l, center[1] + l, center[2] - l) lines.drawTo(center[0] - l, center[1] + l, center[2] + l) lines.drawTo(center[0] + l, center[1] + l, center[2] + l) lines.moveTo(center[0] + l, center[1] - l, center[2] + l) lines.drawTo(center[0] + l, center[1] - l, center[2] - l) lines.drawTo(center[0] - l, center[1] - l, center[2] - l) lines.drawTo(center[0] - l, center[1] - l, center[2] + l) lines.drawTo(center[0] + l, center[1] - l, center[2] + l) lines.moveTo(center[0] + l, center[1] + l, center[2] + l) lines.drawTo(center[0] - l, center[1] + l, center[2] + l) lines.drawTo(center[0] - l, center[1] - l, center[2] + l) lines.drawTo(center[0] + l, center[1] - l, center[2] + l) lines.drawTo(center[0] + l, center[1] + l, center[2] + l) lines.moveTo(center[0] + l, center[1] + l, center[2] - l) lines.drawTo(center[0] - l, center[1] + l, center[2] - l) lines.drawTo(center[0] - l, center[1] - l, center[2] - l) lines.drawTo(center[0] + l, center[1] - l, center[2] - l) lines.drawTo(center[0] + l, center[1] + l, center[2] - l)
def getWidgetIntersectPt(self, nodePath, plane): if hasattr(base.direct, "manipulationControl") and base.direct.manipulationControl.fMultiView and\ base.direct.camera.getName() != 'persp': self.hitPt.assign(self.getMouseIntersectPt()) return self.hitPt # Find out the point of interection of the ray passing though the mouse # with the plane containing the 2D xlation or 1D rotation widgets
PkgDisable("contrib")
PkgDisable("CONTRIB")
def parseopts(args): global INSTALLER,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR global VERSION,COMPRESSOR,THREADCOUNT,OSXTARGET longopts = [ "help","distributor=","verbose","runtime","osxtarget=", "optimize=","everything","nothing","installer","rtdist","nocolor", "version=","lzma","no-python","threads=","outputdir=","override="] anything = 0 optimize = "" for pkg in PkgListGet(): longopts.append("no-"+pkg.lower()) for pkg in PkgListGet(): longopts.append("use-"+pkg.lower()) try: opts, extras = getopt.getopt(args, "", longopts) for option,value in opts: if (option=="--help"): raise "usage" elif (option=="--optimize"): optimize=value elif (option=="--installer"): INSTALLER=1 elif (option=="--verbose"): SetVerbose(True) elif (option=="--distributor"): DISTRIBUTOR=value elif (option=="--rtdist"): RTDIST=1 elif (option=="--runtime"): RUNTIME=1 elif (option=="--genman"): GENMAN=1 elif (option=="--everything"): PkgEnableAll() elif (option=="--nothing"): PkgDisableAll() elif (option=="--threads"): THREADCOUNT=int(value) elif (option=="--outputdir"): SetOutputDir(value.strip()) elif (option=="--osxtarget"): OSXTARGET=value.strip() elif (option=="--nocolor"): DisableColors() elif (option=="--version"): VERSION=value if (len(VERSION.split(".")) != 3): raise "usage" elif (option=="--lzma"): COMPRESSOR="lzma" elif (option=="--override"): AddOverride(value.strip()) else: for pkg in PkgListGet(): if (option=="--use-"+pkg.lower()): PkgEnable(pkg) break for pkg in PkgListGet(): if (option=="--no-"+pkg.lower()): PkgDisable(pkg) break anything = 1 except: usage(0) if (anything==0): usage(0) if (RTDIST and RUNTIME): usage("Options --runtime and --rtdist cannot be specified at the same time!") if (optimize=="" and (RTDIST or RUNTIME)): optimize = "4" elif (optimize==""): optimize = "3" if (OSXTARGET != None and OSXTARGET.strip() == ""): OSXTARGET = None elif (OSXTARGET != None): OSXTARGET = OSXTARGET.strip() if (len(OSXTARGET) != 4 or not OSXTARGET.startswith("10.")): usage("Invalid setting for OSXTARGET") try: OSXTARGET = "10.%d" % int(OSXTARGET[-1]) except: usage("Invalid setting for OSXTARGET") try: SetOptimize(int(optimize)) assert GetOptimize() in [1, 2, 3, 4] except: usage("Invalid setting for OPTIMIZE")
import pdb;pdb.set_trace()
def setTitleWithFilename(self, filename=""): import pdb;pdb.set_trace() title = self.ui.appname if filename != "": filenameshort = os.path.basename(filename) title = title + " (%s)"%filenameshort self.ui.SetLabel(title)
TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'X11', 'XRANDR', 'XF86DGA'])
TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'X11', 'XRANDR', 'XF86DGA', 'XCURSOR'])
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
TargetAdd('libpandagles.dll', opts=['MODULE', 'GLES', 'EGL', 'X11', 'XRANDR', 'XF86DGA'])
TargetAdd('libpandagles.dll', opts=['MODULE', 'GLES', 'EGL', 'X11', 'XRANDR', 'XF86DGA', 'XCURSOR'])
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
TargetAdd('libpandagles2.dll', opts=['MODULE', 'GLES2', 'EGL', 'X11', 'XRANDR', 'XF86DGA'])
TargetAdd('libpandagles2.dll', opts=['MODULE', 'GLES2', 'EGL', 'X11', 'XRANDR', 'XF86DGA', 'XCURSOR'])
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
TargetAdd('libtinydisplay.dll', opts=['X11', 'XRANDR', 'XF86DGA'])
TargetAdd('libtinydisplay.dll', opts=['X11', 'XRANDR', 'XF86DGA', 'XCURSOR'])
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
for vfile in vfs.scanDirectory(self.pathname):
files = vfs.scanDirectory(self.pathname) if files is None: files = [] for vfile in files:
def __init__(self, pathname, ignoreUsageXml = False): self.pathname = pathname self.filenames = [] self.fileSize = 0 self.nested = [] self.nestedSize = 0
LibName("OPENGL", "opengl32.lib") LibName("OPENGL", "glu32.lib")
LibName("GL", "opengl32.lib") LibName("GL", "glu32.lib") LibName("GLES", "libgles_cm.lib") LibName("GLES2", "libGLESv2.lib") LibName("EGL", "libEGL.lib")
def parseopts(args): global INSTALLER,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION global COMPRESSOR,THREADCOUNT,OSXTARGET,HOST_URL,DEBVERSION,RPMRELEASE longopts = [ "help","distributor=","verbose","runtime","osxtarget=", "optimize=","everything","nothing","installer","rtdist","nocolor", "version=","lzma","no-python","threads=","outputdir=","override=", "static","host=","debversion=","rpmrelease="] anything = 0 optimize = "" for pkg in PkgListGet(): longopts.append("no-"+pkg.lower()) for pkg in PkgListGet(): longopts.append("use-"+pkg.lower()) try: opts, extras = getopt.getopt(args, "", longopts) for option,value in opts: if (option=="--help"): raise "usage" elif (option=="--optimize"): optimize=value elif (option=="--installer"): INSTALLER=1 elif (option=="--verbose"): SetVerbose(True) elif (option=="--distributor"): DISTRIBUTOR=value elif (option=="--rtdist"): RTDIST=1 elif (option=="--runtime"): RUNTIME=1 elif (option=="--genman"): GENMAN=1 elif (option=="--everything"): PkgEnableAll() elif (option=="--nothing"): PkgDisableAll() elif (option=="--threads"): THREADCOUNT=int(value) elif (option=="--outputdir"): SetOutputDir(value.strip()) elif (option=="--osxtarget"): OSXTARGET=value.strip() elif (option=="--nocolor"): DisableColors() elif (option=="--version"): VERSION=value if (len(VERSION.split(".")) != 3): raise "usage" elif (option=="--lzma"): COMPRESSOR="lzma" elif (option=="--override"): AddOverride(value.strip()) elif (option=="--static"): SetLinkAllStatic(True) elif (option=="--host"): HOST_URL=value elif (option=="--debversion"): DEBVERSION=value elif (option=="--rpmrelease"): RPMRELEASE=value else: for pkg in PkgListGet(): if (option=="--use-"+pkg.lower()): PkgEnable(pkg) break for pkg in PkgListGet(): if (option=="--no-"+pkg.lower()): PkgDisable(pkg) break if (option=="--everything" or option.startswith("--use-") or option=="--nothing" or option.startswith("--no-")): anything = 1 except: usage(0) if (anything==0): usage(0) if (RTDIST and RUNTIME): usage("Options --runtime and --rtdist cannot be specified at the same time!") if (optimize=="" and (RTDIST or RUNTIME)): optimize = "4" elif (optimize==""): optimize = "3" if (OSXTARGET != None and OSXTARGET.strip() == ""): OSXTARGET = None elif (OSXTARGET != None): OSXTARGET = OSXTARGET.strip() if (len(OSXTARGET) != 4 or not OSXTARGET.startswith("10.")): usage("Invalid setting for OSXTARGET") try: OSXTARGET = "10.%d" % int(OSXTARGET[-1]) except: usage("Invalid setting for OSXTARGET") try: SetOptimize(int(optimize)) assert GetOptimize() in [1, 2, 3, 4] except: usage("Invalid setting for OPTIMIZE")
IncDirectory("OPENGL", "/usr/X11R6/include")
IncDirectory("GL", "/usr/X11R6/include")
def parseopts(args): global INSTALLER,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION global COMPRESSOR,THREADCOUNT,OSXTARGET,HOST_URL,DEBVERSION,RPMRELEASE longopts = [ "help","distributor=","verbose","runtime","osxtarget=", "optimize=","everything","nothing","installer","rtdist","nocolor", "version=","lzma","no-python","threads=","outputdir=","override=", "static","host=","debversion=","rpmrelease="] anything = 0 optimize = "" for pkg in PkgListGet(): longopts.append("no-"+pkg.lower()) for pkg in PkgListGet(): longopts.append("use-"+pkg.lower()) try: opts, extras = getopt.getopt(args, "", longopts) for option,value in opts: if (option=="--help"): raise "usage" elif (option=="--optimize"): optimize=value elif (option=="--installer"): INSTALLER=1 elif (option=="--verbose"): SetVerbose(True) elif (option=="--distributor"): DISTRIBUTOR=value elif (option=="--rtdist"): RTDIST=1 elif (option=="--runtime"): RUNTIME=1 elif (option=="--genman"): GENMAN=1 elif (option=="--everything"): PkgEnableAll() elif (option=="--nothing"): PkgDisableAll() elif (option=="--threads"): THREADCOUNT=int(value) elif (option=="--outputdir"): SetOutputDir(value.strip()) elif (option=="--osxtarget"): OSXTARGET=value.strip() elif (option=="--nocolor"): DisableColors() elif (option=="--version"): VERSION=value if (len(VERSION.split(".")) != 3): raise "usage" elif (option=="--lzma"): COMPRESSOR="lzma" elif (option=="--override"): AddOverride(value.strip()) elif (option=="--static"): SetLinkAllStatic(True) elif (option=="--host"): HOST_URL=value elif (option=="--debversion"): DEBVERSION=value elif (option=="--rpmrelease"): RPMRELEASE=value else: for pkg in PkgListGet(): if (option=="--use-"+pkg.lower()): PkgEnable(pkg) break for pkg in PkgListGet(): if (option=="--no-"+pkg.lower()): PkgDisable(pkg) break if (option=="--everything" or option.startswith("--use-") or option=="--nothing" or option.startswith("--no-")): anything = 1 except: usage(0) if (anything==0): usage(0) if (RTDIST and RUNTIME): usage("Options --runtime and --rtdist cannot be specified at the same time!") if (optimize=="" and (RTDIST or RUNTIME)): optimize = "4" elif (optimize==""): optimize = "3" if (OSXTARGET != None and OSXTARGET.strip() == ""): OSXTARGET = None elif (OSXTARGET != None): OSXTARGET = OSXTARGET.strip() if (len(OSXTARGET) != 4 or not OSXTARGET.startswith("10.")): usage("Invalid setting for OSXTARGET") try: OSXTARGET = "10.%d" % int(OSXTARGET[-1]) except: usage("Invalid setting for OSXTARGET") try: SetOptimize(int(optimize)) assert GetOptimize() in [1, 2, 3, 4] except: usage("Invalid setting for OPTIMIZE")
SmartPkgEnable("OPENGL", "gl", ("GL"), ("GL/gl.h", "GL/glu.h"), framework = "OpenGL")
SmartPkgEnable("GL", "gl", ("GL"), ("GL/gl.h", "GL/glu.h"), framework = "OpenGL") SmartPkgEnable("GLES", "glesv1_cm", ("GLESv1_CM"), ("GLES/gl.h"), framework = "OpenGLES") SmartPkgEnable("GLES2", "glesv2", ("GLESv2"), ("GLES2/gl2.h")) SmartPkgEnable("EGL", "egl", ("EGL"), ("EGL/egl.h"))
def parseopts(args): global INSTALLER,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION global COMPRESSOR,THREADCOUNT,OSXTARGET,HOST_URL,DEBVERSION,RPMRELEASE longopts = [ "help","distributor=","verbose","runtime","osxtarget=", "optimize=","everything","nothing","installer","rtdist","nocolor", "version=","lzma","no-python","threads=","outputdir=","override=", "static","host=","debversion=","rpmrelease="] anything = 0 optimize = "" for pkg in PkgListGet(): longopts.append("no-"+pkg.lower()) for pkg in PkgListGet(): longopts.append("use-"+pkg.lower()) try: opts, extras = getopt.getopt(args, "", longopts) for option,value in opts: if (option=="--help"): raise "usage" elif (option=="--optimize"): optimize=value elif (option=="--installer"): INSTALLER=1 elif (option=="--verbose"): SetVerbose(True) elif (option=="--distributor"): DISTRIBUTOR=value elif (option=="--rtdist"): RTDIST=1 elif (option=="--runtime"): RUNTIME=1 elif (option=="--genman"): GENMAN=1 elif (option=="--everything"): PkgEnableAll() elif (option=="--nothing"): PkgDisableAll() elif (option=="--threads"): THREADCOUNT=int(value) elif (option=="--outputdir"): SetOutputDir(value.strip()) elif (option=="--osxtarget"): OSXTARGET=value.strip() elif (option=="--nocolor"): DisableColors() elif (option=="--version"): VERSION=value if (len(VERSION.split(".")) != 3): raise "usage" elif (option=="--lzma"): COMPRESSOR="lzma" elif (option=="--override"): AddOverride(value.strip()) elif (option=="--static"): SetLinkAllStatic(True) elif (option=="--host"): HOST_URL=value elif (option=="--debversion"): DEBVERSION=value elif (option=="--rpmrelease"): RPMRELEASE=value else: for pkg in PkgListGet(): if (option=="--use-"+pkg.lower()): PkgEnable(pkg) break for pkg in PkgListGet(): if (option=="--no-"+pkg.lower()): PkgDisable(pkg) break if (option=="--everything" or option.startswith("--use-") or option=="--nothing" or option.startswith("--no-")): anything = 1 except: usage(0) if (anything==0): usage(0) if (RTDIST and RUNTIME): usage("Options --runtime and --rtdist cannot be specified at the same time!") if (optimize=="" and (RTDIST or RUNTIME)): optimize = "4" elif (optimize==""): optimize = "3" if (OSXTARGET != None and OSXTARGET.strip() == ""): OSXTARGET = None elif (OSXTARGET != None): OSXTARGET = OSXTARGET.strip() if (len(OSXTARGET) != 4 or not OSXTARGET.startswith("10.")): usage("Invalid setting for OSXTARGET") try: OSXTARGET = "10.%d" % int(OSXTARGET[-1]) except: usage("Invalid setting for OSXTARGET") try: SetOptimize(int(optimize)) assert GetOptimize() in [1, 2, 3, 4] except: usage("Invalid setting for OPTIMIZE")
LibName("OPENGL", "-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
LibName("GL", "-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
def parseopts(args): global INSTALLER,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION global COMPRESSOR,THREADCOUNT,OSXTARGET,HOST_URL,DEBVERSION,RPMRELEASE longopts = [ "help","distributor=","verbose","runtime","osxtarget=", "optimize=","everything","nothing","installer","rtdist","nocolor", "version=","lzma","no-python","threads=","outputdir=","override=", "static","host=","debversion=","rpmrelease="] anything = 0 optimize = "" for pkg in PkgListGet(): longopts.append("no-"+pkg.lower()) for pkg in PkgListGet(): longopts.append("use-"+pkg.lower()) try: opts, extras = getopt.getopt(args, "", longopts) for option,value in opts: if (option=="--help"): raise "usage" elif (option=="--optimize"): optimize=value elif (option=="--installer"): INSTALLER=1 elif (option=="--verbose"): SetVerbose(True) elif (option=="--distributor"): DISTRIBUTOR=value elif (option=="--rtdist"): RTDIST=1 elif (option=="--runtime"): RUNTIME=1 elif (option=="--genman"): GENMAN=1 elif (option=="--everything"): PkgEnableAll() elif (option=="--nothing"): PkgDisableAll() elif (option=="--threads"): THREADCOUNT=int(value) elif (option=="--outputdir"): SetOutputDir(value.strip()) elif (option=="--osxtarget"): OSXTARGET=value.strip() elif (option=="--nocolor"): DisableColors() elif (option=="--version"): VERSION=value if (len(VERSION.split(".")) != 3): raise "usage" elif (option=="--lzma"): COMPRESSOR="lzma" elif (option=="--override"): AddOverride(value.strip()) elif (option=="--static"): SetLinkAllStatic(True) elif (option=="--host"): HOST_URL=value elif (option=="--debversion"): DEBVERSION=value elif (option=="--rpmrelease"): RPMRELEASE=value else: for pkg in PkgListGet(): if (option=="--use-"+pkg.lower()): PkgEnable(pkg) break for pkg in PkgListGet(): if (option=="--no-"+pkg.lower()): PkgDisable(pkg) break if (option=="--everything" or option.startswith("--use-") or option=="--nothing" or option.startswith("--no-")): anything = 1 except: usage(0) if (anything==0): usage(0) if (RTDIST and RUNTIME): usage("Options --runtime and --rtdist cannot be specified at the same time!") if (optimize=="" and (RTDIST or RUNTIME)): optimize = "4" elif (optimize==""): optimize = "3" if (OSXTARGET != None and OSXTARGET.strip() == ""): OSXTARGET = None elif (OSXTARGET != None): OSXTARGET = OSXTARGET.strip() if (len(OSXTARGET) != 4 or not OSXTARGET.startswith("10.")): usage("Invalid setting for OSXTARGET") try: OSXTARGET = "10.%d" % int(OSXTARGET[-1]) except: usage("Invalid setting for OSXTARGET") try: SetOptimize(int(optimize)) assert GetOptimize() in [1, 2, 3, 4] except: usage("Invalid setting for OPTIMIZE")
("HAVE_GL", '1', '1'),
("HAVE_GL", '1', 'UNDEF'), ("HAVE_GLES", 'UNDEF', 'UNDEF'), ("HAVE_GLES2", 'UNDEF', 'UNDEF'),
ProgressOutput(progress, "Building package from pdef file", infile)
TargetAdd('libp3glstuff.dll', opts=['ADVAPI', 'OPENGL', 'NVIDIACG', 'CGGL'])
TargetAdd('libp3glstuff.dll', opts=['ADVAPI', 'GL', 'NVIDIACG', 'CGGL'])
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
if (not RUNTIME and PkgSkip("OPENGL")==0): OPTS=['DIR:panda/src/glgsg', 'DIR:panda/src/glstuff', 'DIR:panda/src/gobj', 'BUILDING:PANDAGL', 'NVIDIACG']
if (not RUNTIME and PkgSkip("GL")==0): OPTS=['DIR:panda/src/glgsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGL', 'NVIDIACG']
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
if (not sys.platform.startswith("win") and PkgSkip("OPENGL")==0 and PkgSkip("OSMESA")==0 and not RUNTIME): OPTS=['DIR:panda/src/mesadisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLUT', 'NVIDIACG', 'OPENGL', 'OSMESA']
if (not sys.platform.startswith("win") and PkgSkip("GL")==0 and PkgSkip("OSMESA")==0 and not RUNTIME): OPTS=['DIR:panda/src/mesadisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLUT', 'NVIDIACG', 'GL', 'OSMESA']
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGLUT', 'NVIDIACG', 'OPENGL']
OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGLUT', 'NVIDIACG', 'GL']
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
TargetAdd('libpandamesa.dll', opts=['MODULE', 'OPENGL', 'OSMESA'])
TargetAdd('libpandamesa.dll', opts=['MODULE', 'GL', 'OSMESA'])
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
if (sys.platform != "win32" and sys.platform != "darwin" and PkgSkip("OPENGL")==0 and PkgSkip("X11")==0 and not RUNTIME): OPTS=['DIR:panda/src/glxdisplay', 'BUILDING:PANDAGLUT', 'OPENGL', 'NVIDIACG', 'CGGL']
if (sys.platform != "win32" and sys.platform != "darwin" and PkgSkip("GL")==0 and PkgSkip("X11")==0 and not RUNTIME): OPTS=['DIR:panda/src/glxdisplay', 'BUILDING:PANDAGLUT', 'GL', 'NVIDIACG', 'CGGL']
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGLUT', 'OPENGL', 'NVIDIACG', 'CGGL']
OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGLUT', 'GL', 'NVIDIACG', 'CGGL']
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
TargetAdd('libpandagl.dll', opts=['MODULE', 'OPENGL', 'NVIDIACG', 'CGGL', 'X11', 'XRANDR', 'XF86DGA'])
TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'X11', 'XRANDR', 'XF86DGA'])
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
if (sys.platform == 'darwin' and PkgSkip("OPENGL")==0 and not RUNTIME): OPTS=['DIR:panda/src/osxdisplay', 'BUILDING:PANDAGLUT', 'OPENGL', 'NVIDIACG', 'CGGL']
if (sys.platform == 'darwin' and PkgSkip("GL")==0 and not RUNTIME): OPTS=['DIR:panda/src/osxdisplay', 'BUILDING:PANDAGLUT', 'GL', 'NVIDIACG', 'CGGL']
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
TargetAdd('libpandagl.dll', opts=['MODULE', 'OPENGL', 'NVIDIACG', 'CGGL', 'CARBON', 'AGL', 'COCOA'])
TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'CARBON', 'AGL', 'COCOA'])
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
if (sys.platform == "win32" and PkgSkip("OPENGL")==0 and not RUNTIME):
if (sys.platform == "win32" and PkgSkip("GL")==0 and not RUNTIME):
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
TargetAdd('libpandagl.dll', opts=['MODULE', 'WINGDI', 'OPENGL', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM', 'NVIDIACG', 'CGGL'])
TargetAdd('libpandagl.dll', opts=['MODULE', 'WINGDI', 'GL', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM', 'NVIDIACG', 'CGGL']) if (PkgSkip("EGL")==0 and PkgSkip("GLES")==0 and PkgSkip("X11")==0 and not RUNTIME): DefSymbol('GLES', 'OPENGLES_1', '') OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES', 'GLES', 'EGL'] TargetAdd('pandagles_egldisplay_composite1.obj', opts=OPTS, input='egldisplay_composite1.cxx') OPTS=['DIR:panda/metalibs/pandagles', 'BUILDING:PANDAGLES', 'GLES', 'EGL'] TargetAdd('pandagles_pandagles.obj', opts=OPTS, input='pandagles.cxx') TargetAdd('libpandagles.dll', input='pandagles_pandagles.obj') TargetAdd('libpandagles.dll', input='glesgsg_config_glesgsg.obj') TargetAdd('libpandagles.dll', input='glesgsg_glesgsg.obj') TargetAdd('libpandagles.dll', input='pandagles_egldisplay_composite1.obj') TargetAdd('libpandagles.dll', input='libp3glstuff.dll') TargetAdd('libpandagles.dll', input=COMMON_PANDA_LIBS) TargetAdd('libpandagles.dll', opts=['MODULE', 'GLES', 'EGL', 'X11', 'XRANDR', 'XF86DGA']) if (PkgSkip("EGL")==0 and PkgSkip("GLES2")==0 and PkgSkip("X11")==0 and not RUNTIME): DefSymbol('GLES2', 'OPENGLES_2', '') OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES2', 'GLES2', 'EGL'] TargetAdd('pandagles2_egldisplay_composite1.obj', opts=OPTS, input='egldisplay_composite1.cxx') OPTS=['DIR:panda/metalibs/pandagles2', 'BUILDING:PANDAGLES2', 'GLES2', 'EGL'] TargetAdd('pandagles2_pandagles2.obj', opts=OPTS, input='pandagles2.cxx') TargetAdd('libpandagles2.dll', input='pandagles2_pandagles2.obj') TargetAdd('libpandagles2.dll', input='gles2gsg_config_gles2gsg.obj') TargetAdd('libpandagles2.dll', input='gles2gsg_gles2gsg.obj') TargetAdd('libpandagles2.dll', input='pandagles2_egldisplay_composite1.obj') TargetAdd('libpandagles2.dll', input='libp3glstuff.dll') TargetAdd('libpandagles2.dll', input=COMMON_PANDA_LIBS) TargetAdd('libpandagles2.dll', opts=['MODULE', 'GLES2', 'EGL', 'X11', 'XRANDR', 'XF86DGA'])
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
TargetAdd('libpandaspeedtree.dll', opts=['OPENGL', 'NVIDIACG', 'CGGL'])
TargetAdd('libpandaspeedtree.dll', opts=['GL', 'NVIDIACG', 'CGGL'])
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
if (not os.path.islink(libname)):
if (libname.endswith(".dylib") and not os.path.islink(libname)):
def MakeInstallerOSX(): if (RUNTIME): # Invoke the make_installer script. AddToPathEnv("DYLD_LIBRARY_PATH", GetOutputDir() + "/plugins") oscmd(SDK["PYTHONEXEC"] + " direct/src/plugin_installer/make_installer.py --version %s" % VERSION) return import compileall if (os.path.isfile("Panda3D-%s.dmg" % VERSION)): oscmd("rm -f Panda3D-%s.dmg" % VERSION) if (os.path.exists("dstroot")): oscmd("rm -rf dstroot") #TODO: add postflight script #oscmd("sed -e 's@\\$1@%s@' < direct/src/directscripts/profilepaths-osx.command >> Panda3D-tpl-rw/panda3dpaths.command" % VERSION) oscmd("mkdir -p dstroot/base/Developer/Panda3D/lib") oscmd("mkdir -p dstroot/base/Developer/Panda3D/etc") oscmd("cp %s/etc/Config.prc dstroot/base/Developer/Panda3D/etc/Config.prc" % GetOutputDir()) oscmd("cp %s/etc/Confauto.prc dstroot/base/Developer/Panda3D/etc/Confauto.prc" % GetOutputDir()) oscmd("cp -R %s/models dstroot/base/Developer/Panda3D/models" % GetOutputDir()) oscmd("cp -R doc/LICENSE dstroot/base/Developer/Panda3D/LICENSE") oscmd("cp -R doc/ReleaseNotes dstroot/base/Developer/Panda3D/ReleaseNotes") if os.path.isdir(GetOutputDir()+"/plugins"): oscmd("cp -R %s/plugins dstroot/base/Developer/Panda3D/plugins" % GetOutputDir()) for base in os.listdir(GetOutputDir()+"/lib"): if (not base.endswith(".a")): libname = "dstroot/base/Developer/Panda3D/lib/" + base # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird. oscmd("cp -R " + GetOutputDir() + "/lib/" + base + " " + libname) # Execute install_name_tool to make them reference an absolute path if (not os.path.islink(libname)): oscmd("install_name_tool -id /Developer/Panda3D/lib/%s %s" % (base, libname), True) oscmd("otool -L %s | grep .%s.dylib > %s/tmp/otool-libs.txt" % (libname, VERSION, GetOutputDir()), True) for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"): if len(line.strip()) > 0 and not line.strip().endswith(":"): libdep = line.strip().split(" ", 1)[0] oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, libname), True) # Scripts to configure this version of Panda3D (in environment.plist) oscmd("mkdir -p dstroot/scripts/base/") postinstall = open("dstroot/scripts/base/postinstall", "w") print >>postinstall, "#!/usr/bin/python" print >>postinstall, "import os, plistlib" print >>postinstall, "home = os.environ['HOME']" print >>postinstall, "if not os.path.isdir(os.path.join(home, '.MacOSX')):" print >>postinstall, " os.mkdir(os.path.join(home, '.MacOSX'))" print >>postinstall, "plist = dict()" print >>postinstall, "envfile = os.path.join(home, '.MacOSX', 'environment.plist')" print >>postinstall, "if os.path.exists(envfile):" print >>postinstall, " plist = plistlib.readPlist(envfile)" print >>postinstall, "paths = {'PATH' : '/Developer/Tools/Panda3D', 'DYLD_LIBRARY_PATH' : '/Developer/Panda3D/lib', 'PYTHONPATH' : '/Developer/Panda3D/lib'," print >>postinstall, " 'MAYA_SCRIPT_PATH' : '/Developer/Panda3D/plugins', 'MAYA_PLUG_IN_PATH' : '/Developer/Panda3D/plugins'}" print >>postinstall, "for env, path in paths.items():" print >>postinstall, " if env not in plist:" print >>postinstall, " plist[env] = path" print >>postinstall, " elif path not in plist[env]:" print >>postinstall, " plist[env] = '%s:%s' % (path, plist[env])" print >>postinstall, "plistlib.writePlist(plist, envfile)" postinstall.close() postflight = open("dstroot/scripts/base/postflight", "w") print >>postflight, "#!/usr/bin/env bash\n" print >>postflight, "RESULT=`/usr/bin/open 'http://www.panda3d.org/wiki/index.php/Getting_Started_on_OSX'`" print >>postflight, "\nexit 0" postflight.close() oscmd("chmod +x dstroot/scripts/base/postinstall") oscmd("chmod +x dstroot/scripts/base/postflight") oscmd("mkdir -p dstroot/tools/Developer/Tools/Panda3D") oscmd("mkdir -p dstroot/tools/Developer/Panda3D") oscmd("ln -s /Developer/Tools/Panda3D dstroot/tools/Developer/Panda3D/bin") for base in os.listdir(GetOutputDir()+"/bin"): binname = "dstroot/tools/Developer/Tools/Panda3D/" + base # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird. oscmd("cp -R " + GetOutputDir() + "/bin/" + base + " " + binname) # Execute install_name_tool to make the binaries reference an absolute path if (not os.path.islink(binname)): oscmd("otool -L %s | grep .%s.dylib > %s/tmp/otool-libs.txt" % (binname, VERSION, GetOutputDir()), True) for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"): if len(line.strip()) > 0 and not line.strip().endswith(":"): libdep = line.strip().split(" ", 1)[0] oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, binname), True) if PkgSkip("PYTHON")==0: oscmd("mkdir -p dstroot/pythoncode/usr/bin") oscmd("mkdir -p dstroot/pythoncode/Developer/Panda3D/lib/direct") oscmd("cp -R %s/pandac dstroot/pythoncode/Developer/Panda3D/lib/pandac" % GetOutputDir()) oscmd("cp -R direct/src/* dstroot/pythoncode/Developer/Panda3D/lib/direct") oscmd("cp direct/src/ffi/panda3d.py dstroot/pythoncode/Developer/Panda3D/lib/panda3d.py") oscmd("ln -s %s dstroot/pythoncode/usr/bin/ppython" % SDK["PYTHONEXEC"]) if os.path.isdir(GetOutputDir()+"/Pmw"): oscmd("cp -R %s/Pmw dstroot/pythoncode/Developer/Panda3D/lib/Pmw" % GetOutputDir()) compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/lib/Pmw") WriteFile("dstroot/pythoncode/Developer/Panda3D/lib/direct/__init__.py", "") for base in os.listdir("dstroot/pythoncode/Developer/Panda3D/lib/direct"): if ((base != "extensions") and (base != "extensions_native")): compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/lib/direct/"+base) oscmd("mkdir -p dstroot/headers/Developer/Panda3D") oscmd("cp -R %s/include dstroot/headers/Developer/Panda3D/include" % GetOutputDir()) if os.path.isdir("samples"): oscmd("mkdir -p dstroot/samples/Developer/Examples/Panda3D") oscmd("cp -R samples/* dstroot/samples/Developer/Examples/Panda3D/") # Dummy package uninstall16 which just contains a preflight script to remove /Applications/Panda3D/ . oscmd("mkdir -p dstroot/scripts/uninstall16/") preflight = open("dstroot/scripts/uninstall16/preflight", "w") print >>preflight, "#!/usr/bin/python" print >>preflight, "import os, re, sys, shutil" print >>preflight, "if os.path.isdir('/Applications/Panda3D'): shutil.rmtree('/Applications/Panda3D')" print >>preflight, "bash_profile = os.path.join(os.environ['HOME'], '.bash_profile')" print >>preflight, "if not os.path.isfile(bash_profile): sys.exit(0)" print >>preflight, "pattern = re.compile('''PANDA_VERSION=[0-9][.][0-9][.][0-9]" print >>preflight, "PANDA_PATH=/Applications/Panda3D/[$A-Z.0-9_]+" print >>preflight, "if \[ -d \$PANDA_PATH \]" print >>preflight, "then(.+?)fi" print >>preflight, "''', flags = re.DOTALL | re.MULTILINE)" print >>preflight, "bpfile = open(bash_profile, 'r')" print >>preflight, "bpdata = bpfile.read()" print >>preflight, "bpfile.close()" print >>preflight, "newbpdata = pattern.sub('', bpdata)" print >>preflight, "if newbpdata == bpdata: sys.exit(0)" print >>preflight, "bpfile = open(bash_profile, 'w')" print >>preflight, "bpfile.write(newbpdata)" print >>preflight, "bpfile.close()" preflight.close() oscmd("chmod +x dstroot/scripts/uninstall16/preflight") oscmd("chmod -R 0775 dstroot/*") # We need to be root to perform a chown. Bleh. # Fortunately PackageMaker does it for us, on 10.5 and above. #oscmd("chown -R root:admin dstroot/*", True) oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/") oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Resources/en.lproj/") pkgs = ["base", "tools", "headers", "uninstall16"] if PkgSkip("PYTHON")==0: pkgs.append("pythoncode") if os.path.isdir("samples"): pkgs.append("samples") for pkg in pkgs: plist = open("/tmp/Info_plist", "w") plist.write(Info_plist % { "package_id" : "org.panda3d.panda3d.%s.pkg" % pkg, "version" : VERSION }) plist.close() if not os.path.isdir("dstroot/" + pkg): os.makedirs("dstroot/" + pkg) if os.path.exists("/Developer/usr/bin/packagemaker"): cmd = '/Developer/usr/bin/packagemaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg --target 10.4 --domain system --root dstroot/' + pkg + '/ --no-relocate' elif os.path.exists("/Developer/Tools/packagemaker"): cmd = '/Developer/usr/bin/packagemaker -build -f dstroot/' + pkg + '/ -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg -i /tmp/Info_plist' else: exit("PackageMaker could not be found!") if os.path.isdir("dstroot/scripts/" + pkg): cmd += ' --scripts dstroot/scripts/' + pkg oscmd(cmd) if os.path.isfile("/tmp/Info_plist"): oscmd("rm -f /tmp/Info_plist") dist = open("dstroot/Panda3D/Panda3D.mpkg/Contents/distribution.dist", "w") print >>dist, '<?xml version="1.0" encoding="utf-8"?>' print >>dist, '<installer-script minSpecVersion="1.000000" authoringTool="com.apple.PackageMaker" authoringToolVersion="3.0.3" authoringToolBuild="174">' print >>dist, ' <title>Panda3D</title>' print >>dist, ' <options customize="always" allow-external-scripts="no" rootVolumeOnly="false"/>' # The following script is to enable the "Uninstall 1.6.x" option only when Panda3D 1.6.x is actually installed. print >>dist, ''' <script>
oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, libname), True)
if not libdep.startswith("/Developer/Panda3D/lib/"): oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, libname), True)
def MakeInstallerOSX(): if (RUNTIME): # Invoke the make_installer script. AddToPathEnv("DYLD_LIBRARY_PATH", GetOutputDir() + "/plugins") oscmd(SDK["PYTHONEXEC"] + " direct/src/plugin_installer/make_installer.py --version %s" % VERSION) return import compileall if (os.path.isfile("Panda3D-%s.dmg" % VERSION)): oscmd("rm -f Panda3D-%s.dmg" % VERSION) if (os.path.exists("dstroot")): oscmd("rm -rf dstroot") #TODO: add postflight script #oscmd("sed -e 's@\\$1@%s@' < direct/src/directscripts/profilepaths-osx.command >> Panda3D-tpl-rw/panda3dpaths.command" % VERSION) oscmd("mkdir -p dstroot/base/Developer/Panda3D/lib") oscmd("mkdir -p dstroot/base/Developer/Panda3D/etc") oscmd("cp %s/etc/Config.prc dstroot/base/Developer/Panda3D/etc/Config.prc" % GetOutputDir()) oscmd("cp %s/etc/Confauto.prc dstroot/base/Developer/Panda3D/etc/Confauto.prc" % GetOutputDir()) oscmd("cp -R %s/models dstroot/base/Developer/Panda3D/models" % GetOutputDir()) oscmd("cp -R doc/LICENSE dstroot/base/Developer/Panda3D/LICENSE") oscmd("cp -R doc/ReleaseNotes dstroot/base/Developer/Panda3D/ReleaseNotes") if os.path.isdir(GetOutputDir()+"/plugins"): oscmd("cp -R %s/plugins dstroot/base/Developer/Panda3D/plugins" % GetOutputDir()) for base in os.listdir(GetOutputDir()+"/lib"): if (not base.endswith(".a")): libname = "dstroot/base/Developer/Panda3D/lib/" + base # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird. oscmd("cp -R " + GetOutputDir() + "/lib/" + base + " " + libname) # Execute install_name_tool to make them reference an absolute path if (not os.path.islink(libname)): oscmd("install_name_tool -id /Developer/Panda3D/lib/%s %s" % (base, libname), True) oscmd("otool -L %s | grep .%s.dylib > %s/tmp/otool-libs.txt" % (libname, VERSION, GetOutputDir()), True) for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"): if len(line.strip()) > 0 and not line.strip().endswith(":"): libdep = line.strip().split(" ", 1)[0] oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, libname), True) # Scripts to configure this version of Panda3D (in environment.plist) oscmd("mkdir -p dstroot/scripts/base/") postinstall = open("dstroot/scripts/base/postinstall", "w") print >>postinstall, "#!/usr/bin/python" print >>postinstall, "import os, plistlib" print >>postinstall, "home = os.environ['HOME']" print >>postinstall, "if not os.path.isdir(os.path.join(home, '.MacOSX')):" print >>postinstall, " os.mkdir(os.path.join(home, '.MacOSX'))" print >>postinstall, "plist = dict()" print >>postinstall, "envfile = os.path.join(home, '.MacOSX', 'environment.plist')" print >>postinstall, "if os.path.exists(envfile):" print >>postinstall, " plist = plistlib.readPlist(envfile)" print >>postinstall, "paths = {'PATH' : '/Developer/Tools/Panda3D', 'DYLD_LIBRARY_PATH' : '/Developer/Panda3D/lib', 'PYTHONPATH' : '/Developer/Panda3D/lib'," print >>postinstall, " 'MAYA_SCRIPT_PATH' : '/Developer/Panda3D/plugins', 'MAYA_PLUG_IN_PATH' : '/Developer/Panda3D/plugins'}" print >>postinstall, "for env, path in paths.items():" print >>postinstall, " if env not in plist:" print >>postinstall, " plist[env] = path" print >>postinstall, " elif path not in plist[env]:" print >>postinstall, " plist[env] = '%s:%s' % (path, plist[env])" print >>postinstall, "plistlib.writePlist(plist, envfile)" postinstall.close() postflight = open("dstroot/scripts/base/postflight", "w") print >>postflight, "#!/usr/bin/env bash\n" print >>postflight, "RESULT=`/usr/bin/open 'http://www.panda3d.org/wiki/index.php/Getting_Started_on_OSX'`" print >>postflight, "\nexit 0" postflight.close() oscmd("chmod +x dstroot/scripts/base/postinstall") oscmd("chmod +x dstroot/scripts/base/postflight") oscmd("mkdir -p dstroot/tools/Developer/Tools/Panda3D") oscmd("mkdir -p dstroot/tools/Developer/Panda3D") oscmd("ln -s /Developer/Tools/Panda3D dstroot/tools/Developer/Panda3D/bin") for base in os.listdir(GetOutputDir()+"/bin"): binname = "dstroot/tools/Developer/Tools/Panda3D/" + base # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird. oscmd("cp -R " + GetOutputDir() + "/bin/" + base + " " + binname) # Execute install_name_tool to make the binaries reference an absolute path if (not os.path.islink(binname)): oscmd("otool -L %s | grep .%s.dylib > %s/tmp/otool-libs.txt" % (binname, VERSION, GetOutputDir()), True) for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"): if len(line.strip()) > 0 and not line.strip().endswith(":"): libdep = line.strip().split(" ", 1)[0] oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, binname), True) if PkgSkip("PYTHON")==0: oscmd("mkdir -p dstroot/pythoncode/usr/bin") oscmd("mkdir -p dstroot/pythoncode/Developer/Panda3D/lib/direct") oscmd("cp -R %s/pandac dstroot/pythoncode/Developer/Panda3D/lib/pandac" % GetOutputDir()) oscmd("cp -R direct/src/* dstroot/pythoncode/Developer/Panda3D/lib/direct") oscmd("cp direct/src/ffi/panda3d.py dstroot/pythoncode/Developer/Panda3D/lib/panda3d.py") oscmd("ln -s %s dstroot/pythoncode/usr/bin/ppython" % SDK["PYTHONEXEC"]) if os.path.isdir(GetOutputDir()+"/Pmw"): oscmd("cp -R %s/Pmw dstroot/pythoncode/Developer/Panda3D/lib/Pmw" % GetOutputDir()) compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/lib/Pmw") WriteFile("dstroot/pythoncode/Developer/Panda3D/lib/direct/__init__.py", "") for base in os.listdir("dstroot/pythoncode/Developer/Panda3D/lib/direct"): if ((base != "extensions") and (base != "extensions_native")): compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/lib/direct/"+base) oscmd("mkdir -p dstroot/headers/Developer/Panda3D") oscmd("cp -R %s/include dstroot/headers/Developer/Panda3D/include" % GetOutputDir()) if os.path.isdir("samples"): oscmd("mkdir -p dstroot/samples/Developer/Examples/Panda3D") oscmd("cp -R samples/* dstroot/samples/Developer/Examples/Panda3D/") # Dummy package uninstall16 which just contains a preflight script to remove /Applications/Panda3D/ . oscmd("mkdir -p dstroot/scripts/uninstall16/") preflight = open("dstroot/scripts/uninstall16/preflight", "w") print >>preflight, "#!/usr/bin/python" print >>preflight, "import os, re, sys, shutil" print >>preflight, "if os.path.isdir('/Applications/Panda3D'): shutil.rmtree('/Applications/Panda3D')" print >>preflight, "bash_profile = os.path.join(os.environ['HOME'], '.bash_profile')" print >>preflight, "if not os.path.isfile(bash_profile): sys.exit(0)" print >>preflight, "pattern = re.compile('''PANDA_VERSION=[0-9][.][0-9][.][0-9]" print >>preflight, "PANDA_PATH=/Applications/Panda3D/[$A-Z.0-9_]+" print >>preflight, "if \[ -d \$PANDA_PATH \]" print >>preflight, "then(.+?)fi" print >>preflight, "''', flags = re.DOTALL | re.MULTILINE)" print >>preflight, "bpfile = open(bash_profile, 'r')" print >>preflight, "bpdata = bpfile.read()" print >>preflight, "bpfile.close()" print >>preflight, "newbpdata = pattern.sub('', bpdata)" print >>preflight, "if newbpdata == bpdata: sys.exit(0)" print >>preflight, "bpfile = open(bash_profile, 'w')" print >>preflight, "bpfile.write(newbpdata)" print >>preflight, "bpfile.close()" preflight.close() oscmd("chmod +x dstroot/scripts/uninstall16/preflight") oscmd("chmod -R 0775 dstroot/*") # We need to be root to perform a chown. Bleh. # Fortunately PackageMaker does it for us, on 10.5 and above. #oscmd("chown -R root:admin dstroot/*", True) oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/") oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Resources/en.lproj/") pkgs = ["base", "tools", "headers", "uninstall16"] if PkgSkip("PYTHON")==0: pkgs.append("pythoncode") if os.path.isdir("samples"): pkgs.append("samples") for pkg in pkgs: plist = open("/tmp/Info_plist", "w") plist.write(Info_plist % { "package_id" : "org.panda3d.panda3d.%s.pkg" % pkg, "version" : VERSION }) plist.close() if not os.path.isdir("dstroot/" + pkg): os.makedirs("dstroot/" + pkg) if os.path.exists("/Developer/usr/bin/packagemaker"): cmd = '/Developer/usr/bin/packagemaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg --target 10.4 --domain system --root dstroot/' + pkg + '/ --no-relocate' elif os.path.exists("/Developer/Tools/packagemaker"): cmd = '/Developer/usr/bin/packagemaker -build -f dstroot/' + pkg + '/ -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg -i /tmp/Info_plist' else: exit("PackageMaker could not be found!") if os.path.isdir("dstroot/scripts/" + pkg): cmd += ' --scripts dstroot/scripts/' + pkg oscmd(cmd) if os.path.isfile("/tmp/Info_plist"): oscmd("rm -f /tmp/Info_plist") dist = open("dstroot/Panda3D/Panda3D.mpkg/Contents/distribution.dist", "w") print >>dist, '<?xml version="1.0" encoding="utf-8"?>' print >>dist, '<installer-script minSpecVersion="1.000000" authoringTool="com.apple.PackageMaker" authoringToolVersion="3.0.3" authoringToolBuild="174">' print >>dist, ' <title>Panda3D</title>' print >>dist, ' <options customize="always" allow-external-scripts="no" rootVolumeOnly="false"/>' # The following script is to enable the "Uninstall 1.6.x" option only when Panda3D 1.6.x is actually installed. print >>dist, ''' <script>
oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, binname), True)
if not libdep.startswith("/Developer/Panda3D/lib/"): oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, binname), True)
def MakeInstallerOSX(): if (RUNTIME): # Invoke the make_installer script. AddToPathEnv("DYLD_LIBRARY_PATH", GetOutputDir() + "/plugins") oscmd(SDK["PYTHONEXEC"] + " direct/src/plugin_installer/make_installer.py --version %s" % VERSION) return import compileall if (os.path.isfile("Panda3D-%s.dmg" % VERSION)): oscmd("rm -f Panda3D-%s.dmg" % VERSION) if (os.path.exists("dstroot")): oscmd("rm -rf dstroot") #TODO: add postflight script #oscmd("sed -e 's@\\$1@%s@' < direct/src/directscripts/profilepaths-osx.command >> Panda3D-tpl-rw/panda3dpaths.command" % VERSION) oscmd("mkdir -p dstroot/base/Developer/Panda3D/lib") oscmd("mkdir -p dstroot/base/Developer/Panda3D/etc") oscmd("cp %s/etc/Config.prc dstroot/base/Developer/Panda3D/etc/Config.prc" % GetOutputDir()) oscmd("cp %s/etc/Confauto.prc dstroot/base/Developer/Panda3D/etc/Confauto.prc" % GetOutputDir()) oscmd("cp -R %s/models dstroot/base/Developer/Panda3D/models" % GetOutputDir()) oscmd("cp -R doc/LICENSE dstroot/base/Developer/Panda3D/LICENSE") oscmd("cp -R doc/ReleaseNotes dstroot/base/Developer/Panda3D/ReleaseNotes") if os.path.isdir(GetOutputDir()+"/plugins"): oscmd("cp -R %s/plugins dstroot/base/Developer/Panda3D/plugins" % GetOutputDir()) for base in os.listdir(GetOutputDir()+"/lib"): if (not base.endswith(".a")): libname = "dstroot/base/Developer/Panda3D/lib/" + base # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird. oscmd("cp -R " + GetOutputDir() + "/lib/" + base + " " + libname) # Execute install_name_tool to make them reference an absolute path if (not os.path.islink(libname)): oscmd("install_name_tool -id /Developer/Panda3D/lib/%s %s" % (base, libname), True) oscmd("otool -L %s | grep .%s.dylib > %s/tmp/otool-libs.txt" % (libname, VERSION, GetOutputDir()), True) for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"): if len(line.strip()) > 0 and not line.strip().endswith(":"): libdep = line.strip().split(" ", 1)[0] oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, libname), True) # Scripts to configure this version of Panda3D (in environment.plist) oscmd("mkdir -p dstroot/scripts/base/") postinstall = open("dstroot/scripts/base/postinstall", "w") print >>postinstall, "#!/usr/bin/python" print >>postinstall, "import os, plistlib" print >>postinstall, "home = os.environ['HOME']" print >>postinstall, "if not os.path.isdir(os.path.join(home, '.MacOSX')):" print >>postinstall, " os.mkdir(os.path.join(home, '.MacOSX'))" print >>postinstall, "plist = dict()" print >>postinstall, "envfile = os.path.join(home, '.MacOSX', 'environment.plist')" print >>postinstall, "if os.path.exists(envfile):" print >>postinstall, " plist = plistlib.readPlist(envfile)" print >>postinstall, "paths = {'PATH' : '/Developer/Tools/Panda3D', 'DYLD_LIBRARY_PATH' : '/Developer/Panda3D/lib', 'PYTHONPATH' : '/Developer/Panda3D/lib'," print >>postinstall, " 'MAYA_SCRIPT_PATH' : '/Developer/Panda3D/plugins', 'MAYA_PLUG_IN_PATH' : '/Developer/Panda3D/plugins'}" print >>postinstall, "for env, path in paths.items():" print >>postinstall, " if env not in plist:" print >>postinstall, " plist[env] = path" print >>postinstall, " elif path not in plist[env]:" print >>postinstall, " plist[env] = '%s:%s' % (path, plist[env])" print >>postinstall, "plistlib.writePlist(plist, envfile)" postinstall.close() postflight = open("dstroot/scripts/base/postflight", "w") print >>postflight, "#!/usr/bin/env bash\n" print >>postflight, "RESULT=`/usr/bin/open 'http://www.panda3d.org/wiki/index.php/Getting_Started_on_OSX'`" print >>postflight, "\nexit 0" postflight.close() oscmd("chmod +x dstroot/scripts/base/postinstall") oscmd("chmod +x dstroot/scripts/base/postflight") oscmd("mkdir -p dstroot/tools/Developer/Tools/Panda3D") oscmd("mkdir -p dstroot/tools/Developer/Panda3D") oscmd("ln -s /Developer/Tools/Panda3D dstroot/tools/Developer/Panda3D/bin") for base in os.listdir(GetOutputDir()+"/bin"): binname = "dstroot/tools/Developer/Tools/Panda3D/" + base # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird. oscmd("cp -R " + GetOutputDir() + "/bin/" + base + " " + binname) # Execute install_name_tool to make the binaries reference an absolute path if (not os.path.islink(binname)): oscmd("otool -L %s | grep .%s.dylib > %s/tmp/otool-libs.txt" % (binname, VERSION, GetOutputDir()), True) for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"): if len(line.strip()) > 0 and not line.strip().endswith(":"): libdep = line.strip().split(" ", 1)[0] oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, binname), True) if PkgSkip("PYTHON")==0: oscmd("mkdir -p dstroot/pythoncode/usr/bin") oscmd("mkdir -p dstroot/pythoncode/Developer/Panda3D/lib/direct") oscmd("cp -R %s/pandac dstroot/pythoncode/Developer/Panda3D/lib/pandac" % GetOutputDir()) oscmd("cp -R direct/src/* dstroot/pythoncode/Developer/Panda3D/lib/direct") oscmd("cp direct/src/ffi/panda3d.py dstroot/pythoncode/Developer/Panda3D/lib/panda3d.py") oscmd("ln -s %s dstroot/pythoncode/usr/bin/ppython" % SDK["PYTHONEXEC"]) if os.path.isdir(GetOutputDir()+"/Pmw"): oscmd("cp -R %s/Pmw dstroot/pythoncode/Developer/Panda3D/lib/Pmw" % GetOutputDir()) compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/lib/Pmw") WriteFile("dstroot/pythoncode/Developer/Panda3D/lib/direct/__init__.py", "") for base in os.listdir("dstroot/pythoncode/Developer/Panda3D/lib/direct"): if ((base != "extensions") and (base != "extensions_native")): compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/lib/direct/"+base) oscmd("mkdir -p dstroot/headers/Developer/Panda3D") oscmd("cp -R %s/include dstroot/headers/Developer/Panda3D/include" % GetOutputDir()) if os.path.isdir("samples"): oscmd("mkdir -p dstroot/samples/Developer/Examples/Panda3D") oscmd("cp -R samples/* dstroot/samples/Developer/Examples/Panda3D/") # Dummy package uninstall16 which just contains a preflight script to remove /Applications/Panda3D/ . oscmd("mkdir -p dstroot/scripts/uninstall16/") preflight = open("dstroot/scripts/uninstall16/preflight", "w") print >>preflight, "#!/usr/bin/python" print >>preflight, "import os, re, sys, shutil" print >>preflight, "if os.path.isdir('/Applications/Panda3D'): shutil.rmtree('/Applications/Panda3D')" print >>preflight, "bash_profile = os.path.join(os.environ['HOME'], '.bash_profile')" print >>preflight, "if not os.path.isfile(bash_profile): sys.exit(0)" print >>preflight, "pattern = re.compile('''PANDA_VERSION=[0-9][.][0-9][.][0-9]" print >>preflight, "PANDA_PATH=/Applications/Panda3D/[$A-Z.0-9_]+" print >>preflight, "if \[ -d \$PANDA_PATH \]" print >>preflight, "then(.+?)fi" print >>preflight, "''', flags = re.DOTALL | re.MULTILINE)" print >>preflight, "bpfile = open(bash_profile, 'r')" print >>preflight, "bpdata = bpfile.read()" print >>preflight, "bpfile.close()" print >>preflight, "newbpdata = pattern.sub('', bpdata)" print >>preflight, "if newbpdata == bpdata: sys.exit(0)" print >>preflight, "bpfile = open(bash_profile, 'w')" print >>preflight, "bpfile.write(newbpdata)" print >>preflight, "bpfile.close()" preflight.close() oscmd("chmod +x dstroot/scripts/uninstall16/preflight") oscmd("chmod -R 0775 dstroot/*") # We need to be root to perform a chown. Bleh. # Fortunately PackageMaker does it for us, on 10.5 and above. #oscmd("chown -R root:admin dstroot/*", True) oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/") oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Resources/en.lproj/") pkgs = ["base", "tools", "headers", "uninstall16"] if PkgSkip("PYTHON")==0: pkgs.append("pythoncode") if os.path.isdir("samples"): pkgs.append("samples") for pkg in pkgs: plist = open("/tmp/Info_plist", "w") plist.write(Info_plist % { "package_id" : "org.panda3d.panda3d.%s.pkg" % pkg, "version" : VERSION }) plist.close() if not os.path.isdir("dstroot/" + pkg): os.makedirs("dstroot/" + pkg) if os.path.exists("/Developer/usr/bin/packagemaker"): cmd = '/Developer/usr/bin/packagemaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg --target 10.4 --domain system --root dstroot/' + pkg + '/ --no-relocate' elif os.path.exists("/Developer/Tools/packagemaker"): cmd = '/Developer/usr/bin/packagemaker -build -f dstroot/' + pkg + '/ -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg -i /tmp/Info_plist' else: exit("PackageMaker could not be found!") if os.path.isdir("dstroot/scripts/" + pkg): cmd += ' --scripts dstroot/scripts/' + pkg oscmd(cmd) if os.path.isfile("/tmp/Info_plist"): oscmd("rm -f /tmp/Info_plist") dist = open("dstroot/Panda3D/Panda3D.mpkg/Contents/distribution.dist", "w") print >>dist, '<?xml version="1.0" encoding="utf-8"?>' print >>dist, '<installer-script minSpecVersion="1.000000" authoringTool="com.apple.PackageMaker" authoringToolVersion="3.0.3" authoringToolBuild="174">' print >>dist, ' <title>Panda3D</title>' print >>dist, ' <options customize="always" allow-external-scripts="no" rootVolumeOnly="false"/>' # The following script is to enable the "Uninstall 1.6.x" option only when Panda3D 1.6.x is actually installed. print >>dist, ''' <script>
oscmd("rpmbuild --define '_rpmdir "+pandasource+"' --root "+pandasource+" --buildroot targetroot -bb panda3d.spec")
oscmd("rpmbuild --define '_rpmdir "+pandasource+"' --buildroot '"+os.abspath("targetroot")+"' -bb panda3d.spec")
def MakeInstallerLinux(): if RUNTIME: # No worries, it won't be used PYTHONV = "python" else: PYTHONV = SDK["PYTHONVERSION"] PV = PYTHONV.replace("python", "") if (os.path.isdir("targetroot")): oscmd("chmod -R 755 targetroot") oscmd("rm -rf targetroot data.tar.gz control.tar.gz panda3d.spec") oscmd("mkdir targetroot") # Invoke installpanda.py to install it into a temporary dir if RUNTIME: InstallRuntime(destdir = "targetroot", outputdir = GetOutputDir()) else: InstallPanda(destdir = "targetroot", outputdir = GetOutputDir()) oscmd("chmod -R 755 targetroot/usr/share/panda3d") if (os.path.exists("/usr/bin/rpmbuild") and not os.path.exists("/usr/bin/dpkg-deb")): oscmd("rm -rf targetroot/DEBIAN") oscmd("rpm -E '%_target_cpu' > "+GetOutputDir()+"/tmp/architecture.txt") ARCH = ReadFile(GetOutputDir()+"/tmp/architecture.txt").strip() pandasource = os.path.abspath(os.getcwd()) if (RUNTIME): txt = RUNTIME_INSTALLER_SPEC_FILE[1:] else: txt = INSTALLER_SPEC_FILE[1:] txt = txt.replace("VERSION", VERSION).replace("RPMRELEASE", RPMRELEASE).replace("PANDASOURCE", pandasource).replace("PV", PV) WriteFile("panda3d.spec", txt) oscmd("rpmbuild --define '_rpmdir "+pandasource+"' --root "+pandasource+" --buildroot targetroot -bb panda3d.spec") if (RUNTIME): oscmd("mv "+ARCH+"/panda3d-runtime-"+VERSION+"-"+RPMRELEASE+"."+ARCH+".rpm .") else: oscmd("mv "+ARCH+"/panda3d-"+VERSION+"-"+RPMRELEASE+"."+ARCH+".rpm .") oscmd("rmdir "+ARCH, True) if (os.path.exists("/usr/bin/dpkg-deb")): oscmd("dpkg --print-architecture > "+GetOutputDir()+"/tmp/architecture.txt") ARCH = ReadFile(GetOutputDir()+"/tmp/architecture.txt").strip() if (RUNTIME): txt = RUNTIME_INSTALLER_DEB_FILE[1:] else: txt = INSTALLER_DEB_FILE[1:] txt = txt.replace("VERSION", DEBVERSION).replace("ARCH", ARCH).replace("PV", PV).replace("MAJOR", MAJOR_VERSION) oscmd("mkdir --mode=0755 -p targetroot/DEBIAN") oscmd("cd targetroot ; (find usr -type f -exec md5sum {} \;) > DEBIAN/md5sums") if (not RUNTIME): oscmd("cd targetroot ; (find etc -type f -exec md5sum {} \;) >> DEBIAN/md5sums") WriteFile("targetroot/DEBIAN/conffiles","/etc/Config.prc\n") WriteFile("targetroot/DEBIAN/postinst","#!/bin/sh\necho running ldconfig\nldconfig\n") oscmd("cp targetroot/DEBIAN/postinst targetroot/DEBIAN/postrm") oscmd("mkdir targetroot/debian") WriteFile("targetroot/debian/control", "") if (RUNTIME): oscmd("ln -s .. targetroot/debian/panda3d-runtime") oscmd("cd targetroot ; dpkg-shlibdeps -xpanda3d-runtime debian/panda3d-runtime/usr/lib*/*.so* debian/panda3d-runtime/usr/bin/*") depends = ReadFile("targetroot/debian/substvars").replace("shlibs:Depends=", "").strip() WriteFile("targetroot/DEBIAN/control", txt.replace("DEPENDS", depends)) else: oscmd("ln -s .. targetroot/debian/panda3d" + MAJOR_VERSION) oscmd("cd targetroot ; dpkg-gensymbols -v%s -ppanda3d%s -eusr%s/panda3d/lib*.so* -ODEBIAN/symbols >/dev/null" % (DEBVERSION, MAJOR_VERSION, libdir)) # Library dependencies are required, binary dependencies are recommended. Dunno why -xlibphysx-extras is needed, prolly a bug in their package oscmd("cd targetroot ; LD_LIBRARY_PATH=usr%s/panda3d dpkg-shlibdeps --ignore-missing-info --warnings=2 -xpanda3d%s -xlibphysx-extras -Tdebian/substvars_dep debian/panda3d%s/usr/lib*/panda3d/lib*.so*" % (libdir, MAJOR_VERSION, MAJOR_VERSION)) oscmd("cd targetroot ; LD_LIBRARY_PATH=usr%s/panda3d dpkg-shlibdeps --ignore-missing-info --warnings=2 -xpanda3d%s -Tdebian/substvars_rec debian/panda3d%s/usr/bin/*" % (libdir, MAJOR_VERSION, MAJOR_VERSION)) depends = ReadFile("targetroot/debian/substvars_dep").replace("shlibs:Depends=", "").strip() recommends = ReadFile("targetroot/debian/substvars_rec").replace("shlibs:Depends=", "").strip() depends += ", " + PYTHONV WriteFile("targetroot/DEBIAN/control", txt.replace("DEPENDS", depends).replace("RECOMMENDS", recommends)) oscmd("rm -rf targetroot/debian") oscmd("chmod -R 755 targetroot/DEBIAN") if (RUNTIME): oscmd("dpkg-deb -b targetroot panda3d-runtime_"+DEBVERSION+"_"+ARCH+".deb") else: oscmd("dpkg-deb -b targetroot panda3d"+MAJOR_VERSION+"_"+DEBVERSION+"_"+ARCH+".deb") oscmd("chmod -R 755 targetroot") if not (os.path.exists("/usr/bin/rpmbuild") or os.path.exists("/usr/bin/dpkg-deb")): exit("To build an installer, either rpmbuild or dpkg-deb must be present on your system!")
if module not in self.freezer.modules.keys() or \ self.freezer.modules[module].exclude:
if module not in moduleDict:
for moduleName, mdef in self.skipModules.items(): if moduleName not in self.freezer.modules: self.freezer.excludeModule( moduleName, allowChildren = mdef.allowChildren, forbid = mdef.forbid, fromSource = 'skip')
cmd += " -arch x86_64 -arch i386"
cmd += " -arch i386"
def CompileCxx(obj,src,opts): ipath = GetListOption(opts, "DIR:") if (COMPILER=="MSVC"): cmd = "cl " if (platform.architecture()[0]=="64bit"): cmd += "/favor:blend " cmd += "/wd4996 /wd4275 /wd4267 /wd4101 /wd4273 /Fo" + obj + " /nologo /c" for x in ipath: cmd += " /I" + x for (opt,dir) in INCDIRECTORIES: if (opt=="ALWAYS") or (opts.count(opt)): cmd += " /I" + BracketNameWithQuotes(dir) for (opt,var,val) in DEFSYMBOLS: if (opt=="ALWAYS") or (opts.count(opt)): cmd += " /D" + var + "=" + val if (opts.count('NOFLOATWARN')): cmd += ' /wd4244 /wd4305' if (opts.count('MSFORSCOPE')): cmd += ' /Zc:forScope-' optlevel = GetOptimizeOption(opts) if (optlevel==1): cmd += " /MDd /Zi /RTCs /GS" if (optlevel==2): cmd += " /MDd /Zi" if (optlevel==3): cmd += " /MD /Zi /O2 /Ob2 /DFORCE_INLINING" if (optlevel==4): cmd += " /MD /Zi /Ox /Ob2 /DFORCE_INLINING /DNDEBUG /GL" cmd += " /Fd" + os.path.splitext(obj)[0] + ".pdb" building = GetValueOption(opts, "BUILDING:") if (building): cmd += " /DBUILDING_" + building if ("BIGOBJ" in opts): cmd += " /bigobj" cmd += " /EHa /Zm300 /DWIN32_VC /DWIN32 /W3 " + BracketNameWithQuotes(src) oscmd(cmd) if (COMPILER=="LINUX"): if (src.endswith(".c")): cmd = 'gcc -fPIC -c -o ' + obj else: cmd = 'g++ -ftemplate-depth-30 -fPIC -c -o ' + obj for (opt, dir) in INCDIRECTORIES: if (opt=="ALWAYS") or (opts.count(opt)): cmd += ' -I' + BracketNameWithQuotes(dir) for (opt,var,val) in DEFSYMBOLS: if (opt=="ALWAYS") or (opts.count(opt)): cmd += ' -D' + var + '=' + val for x in ipath: cmd += ' -I' + x if (sys.platform == "darwin"): cmd += " -Wno-deprecated-declarations" if (OSXTARGET != None): cmd += " -isysroot " + SDK["MACOSX"] cmd += " -mmacosx-version-min=" + OSXTARGET if int(platform.mac_ver()[0][3]) >= 6: cmd += " -arch x86_64 -arch i386" else: cmd += " -arch i386" if ("NOPPC" not in opts): cmd += " -arch ppc" optlevel = GetOptimizeOption(opts) if (optlevel==1): cmd += " -ggdb -D_DEBUG" if (optlevel==2): cmd += " -O1 -D_DEBUG" if (optlevel==3): cmd += " -O2" if (optlevel==4): cmd += " -O3 -DNDEBUG" if (CFLAGS !=""): cmd += " " + CFLAGS building = GetValueOption(opts, "BUILDING:") if (building): cmd += " -DBUILDING_" + building cmd += ' ' + BracketNameWithQuotes(src) oscmd(cmd)
if (COMPILER=="LINUX") and (platform.architecture()[0]=="64bit"):
if (COMPILER=="LINUX") and (platform.architecture()[0]=="64bit") and (sys.platform!="darwin"):
def CompileIgate(woutd,wsrc,opts): outbase = os.path.basename(woutd)[:-3] woutc = GetOutputDir()+"/tmp/"+outbase+"_igate.cxx" wobj = FindLocation(outbase + "_igate.obj", []) srcdir = GetValueOption(opts, "SRCDIR:") module = GetValueOption(opts, "IMOD:") library = GetValueOption(opts, "ILIB:") ipath = GetListOption(opts, "DIR:") if (PkgSkip("PYTHON")): WriteFile(woutc,"") WriteFile(woutd,"") CompileCxx(wobj,woutc,opts) ConditionalWriteFile(woutd,"") return cmd = GetOutputDir()+"/bin/interrogate -srcdir "+srcdir+" -I"+srcdir cmd += ' -Dvolatile -Dmutable' if (COMPILER=="MSVC"): cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -longlong __int64 -D_X86_ -DWIN32_VC -D_WIN32' #NOTE: this 1500 value is the version number for VC2008. cmd += ' -D_MSC_VER=1500 -D"_declspec(param)=" -D_near -D_far -D__near -D__far -D__stdcall' if (COMPILER=="LINUX") and (platform.architecture()[0]=="64bit"): cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const -D_LP64' if (COMPILER=="LINUX") and (platform.architecture()[0]=="32bit"): cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const -D__i386__' optlevel=GetOptimizeOption(opts) if (optlevel==1): cmd += ' -D_DEBUG' if (optlevel==2): cmd += ' -D_DEBUG' if (optlevel==3): cmd += ' -DFORCE_INLINING' if (optlevel==4): cmd += ' -DNDEBUG -DFORCE_INLINING' cmd += ' -oc ' + woutc + ' -od ' + woutd cmd += ' -fnames -string -refcount -assert -python-native' cmd += ' -S' + GetOutputDir() + '/include/parser-inc' for x in ipath: cmd += ' -I' + BracketNameWithQuotes(x) for (opt,dir) in INCDIRECTORIES: if (opt=="ALWAYS") or (opts.count(opt)): cmd += ' -S' + BracketNameWithQuotes(dir) for (opt,var,val) in DEFSYMBOLS: if (opt=="ALWAYS") or (opts.count(opt)): cmd += ' -D' + var + '=' + val building = GetValueOption(opts, "BUILDING:") if (building): cmd += " -DBUILDING_"+building cmd += ' -module ' + module + ' -library ' + library for x in wsrc: if (x.startswith("/")): cmd += ' ' + BracketNameWithQuotes(x) else: cmd += ' ' + BracketNameWithQuotes(os.path.basename(x)) oscmd(cmd) CompileCxx(wobj,woutc,opts) return
cmd += " -arch x86_64 -arch i386"
cmd += " -arch i386"
def CompileLink(dll, obj, opts): if (COMPILER=="MSVC"): cmd = "link /nologo" if (platform.architecture()[0] == "64bit"): cmd += " /MACHINE:X64" if ("MFC" not in opts): cmd += " /NOD:MFC90.LIB /NOD:MFC80.LIB /NOD:LIBCMT" cmd += " /NOD:LIBCI.LIB /DEBUG" cmd += " /nod:libc /nod:libcmtd /nod:atlthunk /nod:atls" if (GetOrigExt(dll) != ".exe"): cmd += " /DLL" optlevel = GetOptimizeOption(opts) if (optlevel==1): cmd += " /MAP /MAPINFO:EXPORTS /NOD:MSVCRT.LIB /NOD:MSVCPRT.LIB /NOD:MSVCIRT.LIB" if (optlevel==2): cmd += " /MAP:NUL /NOD:MSVCRT.LIB /NOD:MSVCPRT.LIB /NOD:MSVCIRT.LIB" if (optlevel==3): cmd += " /MAP:NUL /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LIB" if (optlevel==4): cmd += " /MAP:NUL /LTCG /NOD:MSVCRTD.LIB /NOD:MSVCPRTD.LIB /NOD:MSVCIRTD.LIB" if ("MFC" in opts): if (optlevel<=2): cmd += " /NOD:MSVCRTD.LIB /NOD:mfcs90d.lib mfcs90d.lib MSVCRTD.lib" else: cmd += " /NOD:MSVCRT.LIB /NOD:mfcs90.lib mfcs90.lib MSVCRT.lib" cmd += " /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO " cmd += ' /OUT:' + BracketNameWithQuotes(dll) subsystem = GetValueOption(opts, "SUBSYSTEM:") if (subsystem): cmd += " /SUBSYSTEM:" + subsystem if (dll.endswith(".dll")): cmd += ' /IMPLIB:' + GetOutputDir() + '/lib/'+os.path.splitext(os.path.basename(dll))[0]+".lib" for (opt, dir) in LIBDIRECTORIES: if (opt=="ALWAYS") or (opts.count(opt)): cmd += ' /LIBPATH:' + BracketNameWithQuotes(dir) for x in obj: if (x.endswith(".dll")): cmd += ' ' + GetOutputDir() + '/lib/' + os.path.splitext(os.path.basename(x))[0] + ".lib" elif (x.endswith(".lib")): dname = os.path.splitext(dll)[0]+".dll" if (GetOrigExt(x) != ".ilb" and os.path.exists(GetOutputDir()+"/bin/" + os.path.splitext(os.path.basename(x))[0] + ".dll")): exit("Error: in makepanda, specify "+dname+", not "+x) cmd += ' ' + BracketNameWithQuotes(x) elif (x.endswith(".def")): cmd += ' /DEF:' + BracketNameWithQuotes(x) elif (x.endswith(".dat")): pass else: cmd += ' ' + BracketNameWithQuotes(x) if (GetOrigExt(dll)==".exe" and "NOICON" not in opts): cmd += " " + GetOutputDir() + "/tmp/pandaIcon.res" for (opt, name) in LIBNAMES: if (opt=="ALWAYS") or (opts.count(opt)): cmd += " " + BracketNameWithQuotes(name) oscmd(cmd) SetVC90CRTVersion(dll+".manifest") mtcmd = "mt -manifest " + dll + ".manifest -outputresource:" + dll if (dll.endswith(".exe")==0): mtcmd = mtcmd + ";2" else: mtcmd = mtcmd + ";1" oscmd(mtcmd) if (COMPILER=="LINUX"): if (GetOrigExt(dll)==".exe"): cmd = 'g++ -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp -L/usr/X11R6/lib' else: if (sys.platform == "darwin"): cmd = 'g++ -undefined dynamic_lookup' if ("BUNDLE" in opts): cmd += ' -bundle ' else: cmd += ' -dynamiclib -install_name ' + os.path.basename(dll) cmd += ' -compatibility_version ' + MAJOR_VERSION + ' -current_version ' + VERSION cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp -L/usr/X11R6/lib' else: cmd = 'g++ -shared' if ("MODULE" not in opts): cmd += " -Wl,-soname=" + os.path.basename(dll) cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp -L/usr/X11R6/lib' for x in obj: if (GetOrigExt(x) != ".dat"): base = os.path.basename(x) if (base[-3:]==".so") and (base[:3]=="lib"): cmd += ' -l' + base[3:-3] elif (base[-2:]==".a") and (base[:3]=="lib"): cmd += ' -l' + base[3:-2] else: cmd += ' ' + x if (sys.platform == "darwin"): if (OSXTARGET != None): cmd += " -isysroot " + SDK["MACOSX"] + " -Wl,-syslibroot," + SDK["MACOSX"] cmd += " -mmacosx-version-min=" + OSXTARGET if int(platform.mac_ver()[0][3]) >= 6: cmd += " -arch x86_64 -arch i386" else: cmd += " -arch i386" if ("NOPPC" not in opts): cmd += " -arch ppc" if (LDFLAGS !=""): cmd += " " + LDFLAGS for (opt, dir) in LIBDIRECTORIES: if (opt=="ALWAYS") or (opt in opts): cmd += ' -L' + BracketNameWithQuotes(dir) for (opt, name) in LIBNAMES: if (opt=="ALWAYS") or (opt in opts): cmd += ' ' + BracketNameWithQuotes(name) cmd += " -lpthread" if (not sys.platform.startswith("freebsd")): cmd += " -ldl" oscmd(cmd) if (GetOrigExt(dll)==".exe" and GetOptimizeOption(opts)==4 and "NOSTRIP" not in opts): oscmd("strip " + BracketNameWithQuotes(dll)) os.system("chmod +x " + BracketNameWithQuotes(dll)) if dll.endswith("." + MAJOR_VERSION + ".dylib"): newdll = dll[:-6-len(MAJOR_VERSION)] + "dylib" if (os.path.isfile(newdll)): os.remove(newdll) oscmd("ln -s " + BracketNameWithQuotes(os.path.basename(dll)) + " " + BracketNameWithQuotes(newdll)) elif dll.endswith("." + MAJOR_VERSION): newdll = dll[:-len(MAJOR_VERSION)-1] if (os.path.isfile(newdll)): os.remove(newdll) oscmd("ln -s " + BracketNameWithQuotes(os.path.basename(dll)) + " " + BracketNameWithQuotes(newdll))
self.host = HostInfo(PandaSystem.getPackageHostUrl(), hostDir = hostDir, asMirror = False, perPlatform = True)
self.host = HostInfo(PandaSystem.getPackageHostUrl(), appRunner = base.appRunner, hostDir = hostDir, asMirror = False, perPlatform = True)
def __init__(self, p3dfile, tokens = {}): self.p3dfile = Filename(p3dfile) self.basename = self.p3dfile.getBasenameWoExtension() self.tokens = tokens hostDir = Filename(Filename.getTempDirectory(), 'pdeploy/') hostDir.makeDir() self.host = HostInfo(PandaSystem.getPackageHostUrl(), hostDir = hostDir, asMirror = False, perPlatform = True) self.http = HTTPClient.getGlobalPtr() if not self.host.readContentsFile(): if not self.host.downloadContentsFile(self.http): Standalone.notify.error("couldn't read host") return False
host = HostInfo(self.hostUrl, rootDir = rootDir, asMirror = True, perPlatform = False)
host = HostInfo(self.hostUrl, appRunner = base.appRunner, rootDir = rootDir, asMirror = True, perPlatform = False)
def installPackagesInto(self, rootDir, platform): """ Installs the packages required by the .p3d file into the specified root directory, for the given platform. """ if not self.includeRequires: return host = HostInfo(self.hostUrl, rootDir = rootDir, asMirror = True, perPlatform = False) if not host.readContentsFile(): if not host.downloadContentsFile(self.http): Installer.notify.error("couldn't read host") return for name, version in self.requirements: package = host.getPackage(name, version, platform) if not package.downloadDescFile(self.http): Standalone.notify.warning(" -> %s failed for platform %s" % (package.packageName, package.platform)) continue if not package.downloadPackage(self.http): Standalone.notify.warning(" -> %s failed for platform %s" % (package.packageName, package.platform)) continue # Also install the 'images' package from the same host that p3dembed was downloaded from. host = HostInfo(self.standalone.host.hostUrl, rootDir = rootDir, asMirror = False, perPlatform = False) if not host.readContentsFile(): if not host.downloadContentsFile(self.http): Installer.notify.error("couldn't read host") return for package in host.getPackages(name = "images"): if not package.downloadDescFile(self.http): Standalone.notify.warning(" -> %s failed for platform %s" % (package.packageName, package.platform)) continue if not package.downloadPackage(self.http): Standalone.notify.warning(" -> %s failed for platform %s" % (package.packageName, package.platform)) continue break
host = HostInfo(self.standalone.host.hostUrl, rootDir = rootDir, asMirror = False, perPlatform = False)
host = HostInfo(self.standalone.host.hostUrl, appRunner = base.appRunner, rootDir = rootDir, asMirror = False, perPlatform = False)
def installPackagesInto(self, rootDir, platform): """ Installs the packages required by the .p3d file into the specified root directory, for the given platform. """ if not self.includeRequires: return host = HostInfo(self.hostUrl, rootDir = rootDir, asMirror = True, perPlatform = False) if not host.readContentsFile(): if not host.downloadContentsFile(self.http): Installer.notify.error("couldn't read host") return for name, version in self.requirements: package = host.getPackage(name, version, platform) if not package.downloadDescFile(self.http): Standalone.notify.warning(" -> %s failed for platform %s" % (package.packageName, package.platform)) continue if not package.downloadPackage(self.http): Standalone.notify.warning(" -> %s failed for platform %s" % (package.packageName, package.platform)) continue # Also install the 'images' package from the same host that p3dembed was downloaded from. host = HostInfo(self.standalone.host.hostUrl, rootDir = rootDir, asMirror = False, perPlatform = False) if not host.readContentsFile(): if not host.downloadContentsFile(self.http): Installer.notify.error("couldn't read host") return for package in host.getPackages(name = "images"): if not package.downloadDescFile(self.http): Standalone.notify.warning(" -> %s failed for platform %s" % (package.packageName, package.platform)) continue if not package.downloadPackage(self.http): Standalone.notify.warning(" -> %s failed for platform %s" % (package.packageName, package.platform)) continue break
if (True or (not RUNTIME and not RTDIST)):
if (not RUNTIME and not RTDIST):
pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n"
Release: 1
Release: RPMRELEASE
def MakeInstallerNSIS(file, fullname, smdirectory, installdir): if (os.path.isfile(file)): os.remove(file) elif (os.path.isdir(file)): shutil.rmtree(file) if (RUNTIME): # Invoke the make_installer script. AddToPathEnv("PATH", GetOutputDir() + "\\bin") AddToPathEnv("PATH", GetOutputDir() + "\\plugins") oscmd(SDK["PYTHONEXEC"] + " direct\\src\\plugin_installer\\make_installer.py --version %s" % VERSION) shutil.move("direct\\src\\plugin_installer\\p3d-setup.exe", file) return print "Building "+fullname+" installer. This can take up to an hour." if (COMPRESSOR != "lzma"): print("Note: you are using zlib, which is faster, but lzma gives better compression.") if (os.path.exists("nsis-output.exe")): os.remove("nsis-output.exe") WriteFile(GetOutputDir()+"/tmp/__init__.py", "") psource=os.path.abspath(".") panda=os.path.abspath(GetOutputDir()) cmd="thirdparty/win-nsis/makensis /V2 " cmd=cmd+'/DCOMPRESSOR="'+COMPRESSOR+'" ' cmd=cmd+'/DNAME="'+fullname+'" ' cmd=cmd+'/DSMDIRECTORY="'+smdirectory+'" ' cmd=cmd+'/DINSTALLDIR="'+installdir+'" ' cmd=cmd+'/DOUTFILE="'+psource+'\\nsis-output.exe" ' cmd=cmd+'/DLICENSE="'+panda+'\\LICENSE" ' cmd=cmd+'/DLANGUAGE="English" ' cmd=cmd+'/DRUNTEXT="Visit the Panda Manual" ' cmd=cmd+'/DIBITMAP="panda-install.bmp" ' cmd=cmd+'/DUBITMAP="panda-install.bmp" ' cmd=cmd+'/DPANDA="'+panda+'" ' cmd=cmd+'/DPANDACONF="'+panda+'\\etc" ' cmd=cmd+'/DPSOURCE="'+psource+'" ' cmd=cmd+'/DPYEXTRAS="'+psource+'\\thirdparty\\win-extras" ' cmd=cmd+'"'+psource+'\\direct\\src\\directscripts\\packpanda.nsi"' oscmd(cmd) os.rename("nsis-output.exe", file)
if "/" not in libdep: oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, libname), True)
if not libdep.startswith("/"): oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, os.path.basename(libdep), libname), True)
def MakeInstallerOSX(): if (RUNTIME): # Invoke the make_installer script. AddToPathEnv("DYLD_LIBRARY_PATH", GetOutputDir() + "/plugins") oscmd(SDK["PYTHONEXEC"] + " direct/src/plugin_installer/make_installer.py --version %s" % VERSION) return import compileall if (os.path.isfile("Panda3D-%s.dmg" % VERSION)): oscmd("rm -f Panda3D-%s.dmg" % VERSION) if (os.path.exists("dstroot")): oscmd("rm -rf dstroot") if (os.path.exists("Panda3D-rw.dmg")): oscmd('rm -f Panda3D-rw.dmg') #TODO: add postflight script #oscmd("sed -e 's@\\$1@%s@' < direct/src/directscripts/profilepaths-osx.command >> Panda3D-tpl-rw/panda3dpaths.command" % VERSION) oscmd("mkdir -p dstroot/base/Developer/Panda3D/lib") oscmd("mkdir -p dstroot/base/Developer/Panda3D/etc") oscmd("cp %s/etc/Config.prc dstroot/base/Developer/Panda3D/etc/Config.prc" % GetOutputDir()) oscmd("cp %s/etc/Confauto.prc dstroot/base/Developer/Panda3D/etc/Confauto.prc" % GetOutputDir()) oscmd("cp -R %s/models dstroot/base/Developer/Panda3D/models" % GetOutputDir()) oscmd("cp -R doc/LICENSE dstroot/base/Developer/Panda3D/LICENSE") oscmd("cp -R doc/ReleaseNotes dstroot/base/Developer/Panda3D/ReleaseNotes") if os.path.isdir(GetOutputDir()+"/plugins"): oscmd("cp -R %s/plugins dstroot/base/Developer/Panda3D/plugins" % GetOutputDir()) for base in os.listdir(GetOutputDir()+"/lib"): if (not base.endswith(".a")): libname = "dstroot/base/Developer/Panda3D/lib/" + base # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird. oscmd("cp -R " + GetOutputDir() + "/lib/" + base + " " + libname) # Execute install_name_tool to make them reference an absolute path if (libname.endswith(".dylib") and not os.path.islink(libname)): oscmd("install_name_tool -id /Developer/Panda3D/lib/%s %s" % (base, libname), True) oscmd("otool -L %s | grep .dylib > %s/tmp/otool-libs.txt" % (libname, GetOutputDir()), True) for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"): if len(line.strip()) > 0 and not line.strip().endswith(":"): libdep = line.strip().split(" ", 1)[0] if "/" not in libdep: oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, libname), True) # Scripts to configure this version of Panda3D (in environment.plist) oscmd("mkdir -p dstroot/scripts/base/") postinstall = open("dstroot/scripts/base/postinstall", "w") print >>postinstall, "#!/usr/bin/python" print >>postinstall, "import os, plistlib" print >>postinstall, "home = os.environ['HOME']" print >>postinstall, "if not os.path.isdir(os.path.join(home, '.MacOSX')):" print >>postinstall, " os.mkdir(os.path.join(home, '.MacOSX'))" print >>postinstall, "plist = dict()" print >>postinstall, "envfile = os.path.join(home, '.MacOSX', 'environment.plist')" print >>postinstall, "if os.path.exists(envfile):" print >>postinstall, " plist = plistlib.readPlist(envfile)" print >>postinstall, "paths = {'PATH' : '/Developer/Tools/Panda3D', 'DYLD_LIBRARY_PATH' : '/Developer/Panda3D/lib', 'PYTHONPATH' : '/Developer/Panda3D/lib'," print >>postinstall, " 'MAYA_SCRIPT_PATH' : '/Developer/Panda3D/plugins', 'MAYA_PLUG_IN_PATH' : '/Developer/Panda3D/plugins'}" print >>postinstall, "for env, path in paths.items():" print >>postinstall, " if env not in plist:" print >>postinstall, " plist[env] = path" print >>postinstall, " elif path not in plist[env]:" print >>postinstall, " plist[env] = '%s:%s' % (path, plist[env])" print >>postinstall, "plistlib.writePlist(plist, envfile)" postinstall.close() postflight = open("dstroot/scripts/base/postflight", "w") print >>postflight, "#!/usr/bin/env bash\n" print >>postflight, "RESULT=`/usr/bin/open 'http://www.panda3d.org/wiki/index.php/Getting_Started_on_OSX'`" print >>postflight, "\nexit 0" postflight.close() oscmd("chmod +x dstroot/scripts/base/postinstall") oscmd("chmod +x dstroot/scripts/base/postflight") oscmd("mkdir -p dstroot/tools/Developer/Tools/Panda3D") oscmd("mkdir -p dstroot/tools/Developer/Panda3D") oscmd("ln -s /Developer/Tools/Panda3D dstroot/tools/Developer/Panda3D/bin") for base in os.listdir(GetOutputDir()+"/bin"): binname = "dstroot/tools/Developer/Tools/Panda3D/" + base # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird. oscmd("cp -R " + GetOutputDir() + "/bin/" + base + " " + binname) # Execute install_name_tool to make the binaries reference an absolute path if (not os.path.islink(binname)): oscmd("otool -L %s | grep .dylib > %s/tmp/otool-libs.txt" % (binname, GetOutputDir()), True) for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"): if len(line.strip()) > 0 and not line.strip().endswith(":"): libdep = line.strip().split(" ", 1)[0] if "/" not in libdep: oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, binname), True) if PkgSkip("PYTHON")==0: oscmd("mkdir -p dstroot/pythoncode/usr/bin") oscmd("mkdir -p dstroot/pythoncode/Developer/Panda3D/lib/direct") oscmd("cp -R %s/pandac dstroot/pythoncode/Developer/Panda3D/lib/pandac" % GetOutputDir()) oscmd("cp -R direct/src/* dstroot/pythoncode/Developer/Panda3D/lib/direct") oscmd("cp direct/src/ffi/panda3d.py dstroot/pythoncode/Developer/Panda3D/lib/panda3d.py") oscmd("ln -s %s dstroot/pythoncode/usr/bin/ppython" % SDK["PYTHONEXEC"]) if os.path.isdir(GetOutputDir()+"/Pmw"): oscmd("cp -R %s/Pmw dstroot/pythoncode/Developer/Panda3D/lib/Pmw" % GetOutputDir()) compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/lib/Pmw") WriteFile("dstroot/pythoncode/Developer/Panda3D/lib/direct/__init__.py", "") for base in os.listdir("dstroot/pythoncode/Developer/Panda3D/lib/direct"): if ((base != "extensions") and (base != "extensions_native")): compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/lib/direct/"+base) oscmd("mkdir -p dstroot/headers/Developer/Panda3D") oscmd("cp -R %s/include dstroot/headers/Developer/Panda3D/include" % GetOutputDir()) if os.path.isdir("samples"): oscmd("mkdir -p dstroot/samples/Developer/Examples/Panda3D") oscmd("cp -R samples/* dstroot/samples/Developer/Examples/Panda3D/") # Dummy package uninstall16 which just contains a preflight script to remove /Applications/Panda3D/ . oscmd("mkdir -p dstroot/scripts/uninstall16/") preflight = open("dstroot/scripts/uninstall16/preflight", "w") print >>preflight, "#!/usr/bin/python" print >>preflight, "import os, re, sys, shutil" print >>preflight, "if os.path.isdir('/Applications/Panda3D'): shutil.rmtree('/Applications/Panda3D')" print >>preflight, "bash_profile = os.path.join(os.environ['HOME'], '.bash_profile')" print >>preflight, "if not os.path.isfile(bash_profile): sys.exit(0)" print >>preflight, "pattern = re.compile('''PANDA_VERSION=[0-9][.][0-9][.][0-9]" print >>preflight, "PANDA_PATH=/Applications/Panda3D/[$A-Z.0-9_]+" print >>preflight, "if \[ -d \$PANDA_PATH \]" print >>preflight, "then(.+?)fi" print >>preflight, "''', flags = re.DOTALL | re.MULTILINE)" print >>preflight, "bpfile = open(bash_profile, 'r')" print >>preflight, "bpdata = bpfile.read()" print >>preflight, "bpfile.close()" print >>preflight, "newbpdata = pattern.sub('', bpdata)" print >>preflight, "if newbpdata == bpdata: sys.exit(0)" print >>preflight, "bpfile = open(bash_profile, 'w')" print >>preflight, "bpfile.write(newbpdata)" print >>preflight, "bpfile.close()" preflight.close() oscmd("chmod +x dstroot/scripts/uninstall16/preflight") oscmd("chmod -R 0775 dstroot/*") # We need to be root to perform a chown. Bleh. # Fortunately PackageMaker does it for us, on 10.5 and above. #oscmd("chown -R root:admin dstroot/*", True) oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/") oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Resources/en.lproj/") pkgs = ["base", "tools", "headers", "uninstall16"] if PkgSkip("PYTHON")==0: pkgs.append("pythoncode") if os.path.isdir("samples"): pkgs.append("samples") for pkg in pkgs: plist = open("/tmp/Info_plist", "w") plist.write(Info_plist % { "package_id" : "org.panda3d.panda3d.%s.pkg" % pkg, "version" : VERSION }) plist.close() if not os.path.isdir("dstroot/" + pkg): os.makedirs("dstroot/" + pkg) if os.path.exists("/Developer/usr/bin/packagemaker"): cmd = '/Developer/usr/bin/packagemaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg --target 10.4 --domain system --root dstroot/' + pkg + '/ --no-relocate' elif os.path.exists("/Developer/Tools/packagemaker"): cmd = '/Developer/usr/bin/packagemaker -build -f dstroot/' + pkg + '/ -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg -i /tmp/Info_plist' else: exit("PackageMaker could not be found!") if os.path.isdir("dstroot/scripts/" + pkg): cmd += ' --scripts dstroot/scripts/' + pkg oscmd(cmd) if os.path.isfile("/tmp/Info_plist"): oscmd("rm -f /tmp/Info_plist") dist = open("dstroot/Panda3D/Panda3D.mpkg/Contents/distribution.dist", "w") print >>dist, '<?xml version="1.0" encoding="utf-8"?>' print >>dist, '<installer-script minSpecVersion="1.000000" authoringTool="com.apple.PackageMaker" authoringToolVersion="3.0.3" authoringToolBuild="174">' print >>dist, ' <title>Panda3D</title>' print >>dist, ' <options customize="always" allow-external-scripts="no" rootVolumeOnly="false"/>' # The following script is to enable the "Uninstall 1.6.x" option only when Panda3D 1.6.x is actually installed. print >>dist, ''' <script>
if "/" not in libdep: oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, binname), True)
if not libdep.startswith("/"): oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, os.path.basename(libdep), binname), True)
def MakeInstallerOSX(): if (RUNTIME): # Invoke the make_installer script. AddToPathEnv("DYLD_LIBRARY_PATH", GetOutputDir() + "/plugins") oscmd(SDK["PYTHONEXEC"] + " direct/src/plugin_installer/make_installer.py --version %s" % VERSION) return import compileall if (os.path.isfile("Panda3D-%s.dmg" % VERSION)): oscmd("rm -f Panda3D-%s.dmg" % VERSION) if (os.path.exists("dstroot")): oscmd("rm -rf dstroot") if (os.path.exists("Panda3D-rw.dmg")): oscmd('rm -f Panda3D-rw.dmg') #TODO: add postflight script #oscmd("sed -e 's@\\$1@%s@' < direct/src/directscripts/profilepaths-osx.command >> Panda3D-tpl-rw/panda3dpaths.command" % VERSION) oscmd("mkdir -p dstroot/base/Developer/Panda3D/lib") oscmd("mkdir -p dstroot/base/Developer/Panda3D/etc") oscmd("cp %s/etc/Config.prc dstroot/base/Developer/Panda3D/etc/Config.prc" % GetOutputDir()) oscmd("cp %s/etc/Confauto.prc dstroot/base/Developer/Panda3D/etc/Confauto.prc" % GetOutputDir()) oscmd("cp -R %s/models dstroot/base/Developer/Panda3D/models" % GetOutputDir()) oscmd("cp -R doc/LICENSE dstroot/base/Developer/Panda3D/LICENSE") oscmd("cp -R doc/ReleaseNotes dstroot/base/Developer/Panda3D/ReleaseNotes") if os.path.isdir(GetOutputDir()+"/plugins"): oscmd("cp -R %s/plugins dstroot/base/Developer/Panda3D/plugins" % GetOutputDir()) for base in os.listdir(GetOutputDir()+"/lib"): if (not base.endswith(".a")): libname = "dstroot/base/Developer/Panda3D/lib/" + base # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird. oscmd("cp -R " + GetOutputDir() + "/lib/" + base + " " + libname) # Execute install_name_tool to make them reference an absolute path if (libname.endswith(".dylib") and not os.path.islink(libname)): oscmd("install_name_tool -id /Developer/Panda3D/lib/%s %s" % (base, libname), True) oscmd("otool -L %s | grep .dylib > %s/tmp/otool-libs.txt" % (libname, GetOutputDir()), True) for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"): if len(line.strip()) > 0 and not line.strip().endswith(":"): libdep = line.strip().split(" ", 1)[0] if "/" not in libdep: oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, libname), True) # Scripts to configure this version of Panda3D (in environment.plist) oscmd("mkdir -p dstroot/scripts/base/") postinstall = open("dstroot/scripts/base/postinstall", "w") print >>postinstall, "#!/usr/bin/python" print >>postinstall, "import os, plistlib" print >>postinstall, "home = os.environ['HOME']" print >>postinstall, "if not os.path.isdir(os.path.join(home, '.MacOSX')):" print >>postinstall, " os.mkdir(os.path.join(home, '.MacOSX'))" print >>postinstall, "plist = dict()" print >>postinstall, "envfile = os.path.join(home, '.MacOSX', 'environment.plist')" print >>postinstall, "if os.path.exists(envfile):" print >>postinstall, " plist = plistlib.readPlist(envfile)" print >>postinstall, "paths = {'PATH' : '/Developer/Tools/Panda3D', 'DYLD_LIBRARY_PATH' : '/Developer/Panda3D/lib', 'PYTHONPATH' : '/Developer/Panda3D/lib'," print >>postinstall, " 'MAYA_SCRIPT_PATH' : '/Developer/Panda3D/plugins', 'MAYA_PLUG_IN_PATH' : '/Developer/Panda3D/plugins'}" print >>postinstall, "for env, path in paths.items():" print >>postinstall, " if env not in plist:" print >>postinstall, " plist[env] = path" print >>postinstall, " elif path not in plist[env]:" print >>postinstall, " plist[env] = '%s:%s' % (path, plist[env])" print >>postinstall, "plistlib.writePlist(plist, envfile)" postinstall.close() postflight = open("dstroot/scripts/base/postflight", "w") print >>postflight, "#!/usr/bin/env bash\n" print >>postflight, "RESULT=`/usr/bin/open 'http://www.panda3d.org/wiki/index.php/Getting_Started_on_OSX'`" print >>postflight, "\nexit 0" postflight.close() oscmd("chmod +x dstroot/scripts/base/postinstall") oscmd("chmod +x dstroot/scripts/base/postflight") oscmd("mkdir -p dstroot/tools/Developer/Tools/Panda3D") oscmd("mkdir -p dstroot/tools/Developer/Panda3D") oscmd("ln -s /Developer/Tools/Panda3D dstroot/tools/Developer/Panda3D/bin") for base in os.listdir(GetOutputDir()+"/bin"): binname = "dstroot/tools/Developer/Tools/Panda3D/" + base # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird. oscmd("cp -R " + GetOutputDir() + "/bin/" + base + " " + binname) # Execute install_name_tool to make the binaries reference an absolute path if (not os.path.islink(binname)): oscmd("otool -L %s | grep .dylib > %s/tmp/otool-libs.txt" % (binname, GetOutputDir()), True) for line in open(GetOutputDir()+"/tmp/otool-libs.txt", "r"): if len(line.strip()) > 0 and not line.strip().endswith(":"): libdep = line.strip().split(" ", 1)[0] if "/" not in libdep: oscmd("install_name_tool -change %s /Developer/Panda3D/lib/%s %s" % (libdep, libdep, binname), True) if PkgSkip("PYTHON")==0: oscmd("mkdir -p dstroot/pythoncode/usr/bin") oscmd("mkdir -p dstroot/pythoncode/Developer/Panda3D/lib/direct") oscmd("cp -R %s/pandac dstroot/pythoncode/Developer/Panda3D/lib/pandac" % GetOutputDir()) oscmd("cp -R direct/src/* dstroot/pythoncode/Developer/Panda3D/lib/direct") oscmd("cp direct/src/ffi/panda3d.py dstroot/pythoncode/Developer/Panda3D/lib/panda3d.py") oscmd("ln -s %s dstroot/pythoncode/usr/bin/ppython" % SDK["PYTHONEXEC"]) if os.path.isdir(GetOutputDir()+"/Pmw"): oscmd("cp -R %s/Pmw dstroot/pythoncode/Developer/Panda3D/lib/Pmw" % GetOutputDir()) compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/lib/Pmw") WriteFile("dstroot/pythoncode/Developer/Panda3D/lib/direct/__init__.py", "") for base in os.listdir("dstroot/pythoncode/Developer/Panda3D/lib/direct"): if ((base != "extensions") and (base != "extensions_native")): compileall.compile_dir("dstroot/pythoncode/Developer/Panda3D/lib/direct/"+base) oscmd("mkdir -p dstroot/headers/Developer/Panda3D") oscmd("cp -R %s/include dstroot/headers/Developer/Panda3D/include" % GetOutputDir()) if os.path.isdir("samples"): oscmd("mkdir -p dstroot/samples/Developer/Examples/Panda3D") oscmd("cp -R samples/* dstroot/samples/Developer/Examples/Panda3D/") # Dummy package uninstall16 which just contains a preflight script to remove /Applications/Panda3D/ . oscmd("mkdir -p dstroot/scripts/uninstall16/") preflight = open("dstroot/scripts/uninstall16/preflight", "w") print >>preflight, "#!/usr/bin/python" print >>preflight, "import os, re, sys, shutil" print >>preflight, "if os.path.isdir('/Applications/Panda3D'): shutil.rmtree('/Applications/Panda3D')" print >>preflight, "bash_profile = os.path.join(os.environ['HOME'], '.bash_profile')" print >>preflight, "if not os.path.isfile(bash_profile): sys.exit(0)" print >>preflight, "pattern = re.compile('''PANDA_VERSION=[0-9][.][0-9][.][0-9]" print >>preflight, "PANDA_PATH=/Applications/Panda3D/[$A-Z.0-9_]+" print >>preflight, "if \[ -d \$PANDA_PATH \]" print >>preflight, "then(.+?)fi" print >>preflight, "''', flags = re.DOTALL | re.MULTILINE)" print >>preflight, "bpfile = open(bash_profile, 'r')" print >>preflight, "bpdata = bpfile.read()" print >>preflight, "bpfile.close()" print >>preflight, "newbpdata = pattern.sub('', bpdata)" print >>preflight, "if newbpdata == bpdata: sys.exit(0)" print >>preflight, "bpfile = open(bash_profile, 'w')" print >>preflight, "bpfile.write(newbpdata)" print >>preflight, "bpfile.close()" preflight.close() oscmd("chmod +x dstroot/scripts/uninstall16/preflight") oscmd("chmod -R 0775 dstroot/*") # We need to be root to perform a chown. Bleh. # Fortunately PackageMaker does it for us, on 10.5 and above. #oscmd("chown -R root:admin dstroot/*", True) oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/") oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Resources/en.lproj/") pkgs = ["base", "tools", "headers", "uninstall16"] if PkgSkip("PYTHON")==0: pkgs.append("pythoncode") if os.path.isdir("samples"): pkgs.append("samples") for pkg in pkgs: plist = open("/tmp/Info_plist", "w") plist.write(Info_plist % { "package_id" : "org.panda3d.panda3d.%s.pkg" % pkg, "version" : VERSION }) plist.close() if not os.path.isdir("dstroot/" + pkg): os.makedirs("dstroot/" + pkg) if os.path.exists("/Developer/usr/bin/packagemaker"): cmd = '/Developer/usr/bin/packagemaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg --target 10.4 --domain system --root dstroot/' + pkg + '/ --no-relocate' elif os.path.exists("/Developer/Tools/packagemaker"): cmd = '/Developer/usr/bin/packagemaker -build -f dstroot/' + pkg + '/ -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg -i /tmp/Info_plist' else: exit("PackageMaker could not be found!") if os.path.isdir("dstroot/scripts/" + pkg): cmd += ' --scripts dstroot/scripts/' + pkg oscmd(cmd) if os.path.isfile("/tmp/Info_plist"): oscmd("rm -f /tmp/Info_plist") dist = open("dstroot/Panda3D/Panda3D.mpkg/Contents/distribution.dist", "w") print >>dist, '<?xml version="1.0" encoding="utf-8"?>' print >>dist, '<installer-script minSpecVersion="1.000000" authoringTool="com.apple.PackageMaker" authoringToolVersion="3.0.3" authoringToolBuild="174">' print >>dist, ' <title>Panda3D</title>' print >>dist, ' <options customize="always" allow-external-scripts="no" rootVolumeOnly="false"/>' # The following script is to enable the "Uninstall 1.6.x" option only when Panda3D 1.6.x is actually installed. print >>dist, ''' <script>
buffer.addRenderTexture(depthtex, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPDepthStencil)
buffer.addRenderTexture(depthtex, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPDepth)
def createBuffer(self, name, xsize, ysize, texgroup, depthbits=1): """ Low-level buffer creation. Not intended for public use. """
def __init__(self, name=None, grp=None, cfg=None, frameCount=1):
def __init__(self, name=None, grp=None, cfg=None, iff=True):
def __init__(self, name=None, grp=None, cfg=None, frameCount=1): #check early out conditions if not bpEnabled: return
if not iff:
if not self.iff or not iff:
def shouldBreak(self,iff=True): #check easy early out if not iff: return False
def __init__(self,name,grp=None,cfg=None,frameCount=1):
def __init__(self,name,grp=None,cfg=None,iff=True):
def __init__(self,name,grp=None,cfg=None,frameCount=1): pass
if dbp.shouldBreak(iff=iff): dbp.doBreak(frameCount=frameCount+1)
dbp.maybeBreak(iff=iff,frameCount=frameCount+1)
def wrap(*args, **kwds): #create our bp object dname = name or f.__name__ dgrp = grp dcfg = cfg dbp = bp(name=dname,grp=dgrp,cfg=dcfg) if dbp.shouldBreak(iff=iff): dbp.doBreak(frameCount=frameCount+1) f_result = f(*args, **kwds) return f_result