From 2bb7c5ff74fdcd36f0d077be538a2d11319a1274 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Sep 22 2011 06:44:54 +0000 Subject: Add `trunk/Scripts/Python/Repository' directory: - This directory contains some ideas related to a possible `centos-art.py' script. These ideas were written before `Webenv' and need to be reorganized in order to make them functional. --- diff --git a/Scripts/Python/Repository/framework.py b/Scripts/Python/Repository/framework.py new file mode 100755 index 0000000..92e512a --- /dev/null +++ b/Scripts/Python/Repository/framework.py @@ -0,0 +1,90 @@ +# framework - The CentOS Artwork Repository framework structure. +# +# Copyright (C) 2009-2010 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +#------------------------------------------------------------ +# $Id: framework.py 6045 2010-07-13 08:11:03Z al $ +#----------------------------------------------------------- +""" +The CentOS Artwork Repository framework structure. + +""" + +import string +import os +import re + +from repository import Repo + +class Framework: + """ + This structure provides attributes and methods needed by CentOS + artwork repository framework structures. + """ + + def __init__(self): + self.fw = {} + + def find(self,id): + """ + Return a dictionary object containing information about + frameworks. This function explores the repository structure + looking for framework directories. Framework directories are + defined as regular directories containing at least the + subdirectory `tpl/' in its first level. + """ + repo = Repo() + rootdir = str(repo.abspath + repo.workline[0]) + template = re.compile('^.*/tpl/?$') + for root, dirs, files in os.walk(rootdir): + if id in root and template.match(root): + print root + #pathid = self.getPathId(root) + #self.fw[pathid] = self.add(pathid) + + def getPathId(self, path): + """ + Return the framework's path id by cleaning up its string path. + """ + # Remove absolute path and workline from string path. + # Remove theme directory from string path. + # Remove template directory from string path. + pass + + def add(self, pathid): + """ + Return the framework's templates, translations and manuals paths. + """ + templates = str('trunk/' + pathid + '/tpl') + translations = str('trunk/Translations/' + pathid) + manuals = str('trunk/Manuals/' + pathid) + return (templates, translations, manuals) + + def list(self, id): + """ + Print available frameworks and its paths. + """ + self.find(id) + for k, v in self.fw.iteritems(): + pathid = k + templates, translations, manuals = v + print '%12s: %s' % ('Id', pathid) + print '%12s: %s' % ('Templates', templates) + print '%12s: %s' % ('Translations', translations) + print '%12s: %s' % ('Manuals', manuals) + print '-'*66 diff --git a/Scripts/Python/Repository/init.py b/Scripts/Python/Repository/init.py new file mode 100755 index 0000000..744776e --- /dev/null +++ b/Scripts/Python/Repository/init.py @@ -0,0 +1,78 @@ +#!/usr/bin/python +# +# centos-art-cli.py - The CentOS Artwork Repository ToolBox (art) +# command line interface. +# +# Copyright (C) 2009-2010 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +#------------------------------------------------------------ +# $Id: centos-art.py 6245 2010-08-12 14:44:19Z al $ +#----------------------------------------------------------- +""" +The CentOS Artwork Repository Toolbox (art) command line interface. + +This script provides a command line interface (cli) to operate local +working copies of CentOS Artwork Repository. Most of the actions this +script can perform relay on CentOS Artwork Repository files and +directories standard structure. The CentOS Artwork Repository standard +structure is described inside the `Repo' class as docstrings. The +`Repo' class is available in the repository.py file. + +In order to make this script available along CentOS Artwork Repository +you need create a link to the file art-cli.py inside /home/centos/bin/ +directory. For example: + + $ mkdir /home/centos/bin/ + $ cd /home/centos/bin/ + $ ln -s /home/centos/artwork/trunk/Scripts/Python/centos-art-cli.py centos-art + +Note that we used the `centos' lower-case word as username. This is a +convention[1] that let us create a common absolute path for people to +store the CentOS Artwork Repository working copy. + + [1:] Absolute paths are used Inkscape to import raster images + inside SVG files--well, to link them really. If everyone + downloading a working copy of CentOS Artwork Repository uses its + one absolute path there is no way to garantee that all images + imported inside SVG design templates will be displayed correctly + in all downloaded working copies. That is because, there is no way + to garantee that everyone's working copy is placed in the same + absolute path the raster image was imported the first time. So the + absolute path name convenction is needed. + +The centos-art-cli.py script let you to: + + * Render images and texts using common design models and + translations. + + * Navigate the repository structure. + + * Get information about repository structures. + + * Test themes. + +""" + +#from repository import Repo +from framework import Framework + +def main(): + fw = Framework() + fw.list('Brands') + +if __name__ == '__main__': main() diff --git a/Scripts/Python/Repository/repository.py b/Scripts/Python/Repository/repository.py new file mode 100755 index 0000000..de71d4e --- /dev/null +++ b/Scripts/Python/Repository/repository.py @@ -0,0 +1,70 @@ +# Copyright (C) 2009-2010 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +#------------------------------------------------------------ +# $Id: repository.py 6036 2010-07-09 21:20:27Z al $ +#----------------------------------------------------------- +""" +The CentOS Artwork Repository. + +The CentOS Artwork Repository is a subversion-based file structure +organized to produce the CentOS project's corporate visual identity. +The CentOS Project corporate visual identity is the ``persona'' of the +organization known as The CentOS Project. + +The CentOS Project corporate visual identity plays a significant role +in the way the CentOS Project, as organization, presents itself to +both internal and external stakeholders. In general terms, the CentOS +Project corporate visual identity expresses the values and ambitions +of the CentOS Project organization, its business, and its +characteristics. The CentOS Project corporate visual identity +provides visibility, recognizability, reputation, structure and +identification to the CentOS Project organization by means of +corporate design, corporate communication, and corporate behaviour. + +The CentOS Project settles down its corporate visual identity on a +``monolithic corporate visual identity structure''. In this structure +The CentOS Project uses one unique name and one unique visual style in +all its manifestations. + +Inside CentOS Artwork Repository, visual manifestations are organized +in the categories: distributions, websites, and promotion. + +Inside CentOS Artwork Repository, corporate visual identity is +oraganized in the work lines: graphic-design, translations, and +programming (scripts). Each work line is a group of people that, based +on standard patterns, can work indepently and coordinated one another. + +In the structure just mentioned, graphic designers provide the design +models and visual styles (motifs) needed to cover each each visual +manifestation; translators create the language-specific contents; and +programmers gear everything together in order to produce specific +design models on various visual styles, languages, and major releases, +automatically. +""" + +class Repo: + """ + This class provides attributes and methods needed to implement the + base repository structure. + """ + + def __init__(self): + # Define repository's working copy absolute path. + self.abspath = '/home/centos/artwork/' + # Define repository's working line. + self.workline = ('trunk/', 'branches/', 'tags/')