Exemplo n.º 1
0
	def __init__(self, parameters, include, output_path, filetype, default_umask = None, default_chmod_files = None, default_chmod_dirs = None, timeout_retries = 5, event_handler = None):
	#
		"""
Constructor __init__(PyBuilder)

:param parameters: DEFINE statements
:param include: String (delimiter is ",") with directory or file names to
                be included.
:param output_path: Output path
:param filetype: String (delimiter is ",") with extensions of files to be
                 parsed.
:param default_umask umask: to set before creating new directories or files
:param default_chmod_files: chmod to set when creating a new file
:param default_chmod_dirs: chmod to set when creating a new directory
:param timeout_retries: Retries before timing out
:param event_handler: EventHandler to use

:since: v0.1.00
		"""

		BuilderSkel.__init__(self,
		                     parameters,
		                     include,
		                     output_path,
		                     filetype,
		                     default_umask,
		                     default_chmod_files,
		                     default_chmod_dirs,
		                     timeout_retries,
		                     event_handler
		                    )

		self.dir_exclude_list = [ "__pycache__" ]
Exemplo n.º 2
0
	def _write_file(self, file_content, file_pathname, file_mode = "w+b"):
	#
		"""
Write the given file to the defined location. Create subdirectories if
needed.

:param file_content: Parsed content
:param file_pathname: Path to the output file
:param file_mode: Filemode to use

:return: (bool) True on success
:since:  v0.1.00
		"""

		if (self._get_variable("js_min_filenames") != None
		    and file_pathname[-7:].lower() != ".min.js"
		    and self._get_variable("debug") == None
		   ):
		#
			( file_pathname, file_ext ) = path.splitext(file_pathname)
			if (len(file_ext) > 0): file_pathname = "{0}.min{1}".format(file_pathname, file_ext)
		#

		return BuilderSkel._write_file(self, file_content, file_pathname, file_mode)
	#
#

##j## EOF
Exemplo n.º 3
0
	def _parse_data(self, data, file_pathname, file_name):
	#
		"""
Parse the given content.

:param data: Data to be parsed
:param file_pathname: File path
:param file_name: File name

:return: (str) Filtered data
:since:  v0.1.00
		"""

		if (self.event_handler != None): self.event_handler.debug("#echo(__FILEPATH__)# -CssBuilder._parse_data(data)- (#echo(__LINE__)#)")

		if (path.splitext(file_name)[-1].lower() == ".scss"):
		#
			config.STATIC_URL = ""
			data = Scss().compile(data)
		#

		if (self._get_variable("css_min_filenames") != None
		    and file_name[-8:].lower() != ".min.css"
		    and self._get_variable("debug") == None
		   ): data = cssmin(data)

		if (self._get_variable("css_header") != None): data = "/* {0} */\n{1}".format(self._get_variable("css_header"), data)
		return BuilderSkel._parse_data(self, data, file_pathname, file_name)
Exemplo n.º 4
0
	def _is_excluded_file(self, filename):
	#
		"""
Returns true if the file should be excluded.

:param filename: File name

:return: (bool) True if excluded
:since:  v0.1.00
		"""

		return (filename[0] == "_" or BuilderSkel._is_excluded_file(self, filename))
Exemplo n.º 5
0
	def _parse_data(self, data, file_pathname, file_name):
	#
		"""
Parse the given content.

:param data: Data to be parsed
:param file_pathname: File path
:param file_name: File name

:return: (str) Filtered data
:since:  v0.1.00
		"""

		if (self.event_handler != None): self.event_handler.debug("#echo(__FILEPATH__)# -PyBuilder._parse_data(data)- (#echo(__LINE__)#)")
		data = self._parse('"""#', BuilderSkel._parse_data(self, data, file_pathname, file_name))

		if (self._get_variable("dev_comments") == None): return self._remove_data_dev_comments(data)
		else: return data
Exemplo n.º 6
0
	def _parse_data(self, data, file_pathname, file_name):
	#
		"""
Parse the given content.

:param data: Data to be parsed
:param file_pathname: File path
:param file_name: File name

:return: (str) Filtered data
:since:  v0.1.00
		"""

		if (self.event_handler != None): self.event_handler.debug("#echo(__FILEPATH__)# -JsBuilder._parse_data(data)- (#echo(__LINE__)#)")

		if (self._get_variable("js_min_filenames") != None
		    and file_pathname[-7:].lower() != ".min.js"
		    and self._get_variable("debug") == None
		   ): data = minify(data, True)

		if (self._get_variable("js_header") != None): data = "// {0}\n{1}".format(self._get_variable("js_header"), data)
		return BuilderSkel._parse_data(self, data, file_pathname, file_name)