コード例 #1
0
ファイル: Environments.py プロジェクト: KDAB/Make-O-Matic
	def _findMomDependencies( self, folder ):
		"""recursively find leaf nodes within folder"""
		leafNodes = []
		if os.path.isdir( folder ):
			elements = os.listdir( folder )
			for element in elements:
				mApp().debugN( self, 4, 'checking if {0} is a MOM dependency'.format( element ) )
				path = os.path.join( folder, element )
				dependency = Dependency( path )
				if dependency.verify():
					# if self._directoryIsLeafNode( path ):
					leafNodes.append( dependency )
				elif os.path.isdir( path ):
					leafNodes.extend( self._findMomDependencies( path ) )
		return leafNodes
コード例 #2
0
ファイル: EnvironmentTests.py プロジェクト: KDAB/Make-O-Matic
	def testApplyPackageConfiguration( self ):
		packageFolder = os.path.join( self.TEST_MOM_ENVIRONMENTS, 'dep-a-1.1.0' )
		packageFile = os.path.join( packageFolder, Dependency._ControlFileName )
		self.assertTrue( os.path.exists( packageFile ) )
		dep = Dependency()
		dep.setFolder( packageFolder )
		self.assertTrue( dep._readControlFile( packageFile ) )
		self.assertTrue( dep.isEnabled() )
		self.assertEquals( dep.getObjectStatus(), 'test-dep-a-1.1.0' )
		with EnvironmentSaver():
			dep.apply()
			self.assertEquals( os.environ[ 'EXAMPLE_VARIABLE'], 'example_variable' )
			self.assertTrue( os.environ['PATH'].startswith( 'example_path' ) )
コード例 #3
0
ファイル: EnvironmentTests.py プロジェクト: KDAB/Make-O-Matic
	def testApplyDisabledPackageConfiguration( self ):
		packageFolder = os.path.join( self.TEST_MOM_ENVIRONMENTS, 'dep-a-1.2.0' )
		packageFile = os.path.join( packageFolder, Dependency._ControlFileName )
		self.assertTrue( os.path.exists( packageFile ) )
		dep = Dependency()
		dep.setFolder( packageFolder )
		self.assertTrue( dep._readControlFile( packageFile ) )
		self.assertTrue( not dep.isEnabled() )
		self.assertEquals( dep.getObjectStatus(), 'test-disabled-dep-a-1.2.0' )
		self.assertEquals( dep.getScore(), 120 )