diff options
author | Alessio Sergi <al3hex@gmail.com> | 2013-02-22 20:55:00 +0100 |
---|---|---|
committer | Alessio Sergi <al3hex@gmail.com> | 2013-02-22 20:55:00 +0100 |
commit | 0560f6387ef489874fa30e83eaf6e8415ea760b5 (patch) | |
tree | 9dd2a19a28535b2ffc7e4b00879279ee0ffd9f28 | |
parent | a1cad521342c6f73607e55630b33c24f1623cec8 (diff) |
Improve packaging
-rw-r--r-- | MANIFEST.in | 8 | ||||
-rw-r--r-- | NEWS | 133 | ||||
-rw-r--r-- | README | 19 | ||||
-rw-r--r-- | README.md | 19 | ||||
-rw-r--r-- | doc/screenshot-wide.png (renamed from screenshot-wide.png) | bin | 149658 -> 149658 bytes | |||
-rw-r--r-- | doc/screenshot.png (renamed from screenshot.png) | bin | 71071 -> 71071 bytes | |||
-rw-r--r-- | glances/data/css/default.css (renamed from glances/css/default.css) | 0 | ||||
-rw-r--r-- | glances/data/html/base.html (renamed from glances/html/base.html) | 0 | ||||
-rw-r--r-- | glances/data/html/default.html (renamed from glances/html/default.html) | 0 | ||||
-rw-r--r-- | glances/data/img/bg.png (renamed from glances/img/bg.png) | bin | 20623 -> 20623 bytes | |||
-rw-r--r--[-rwxr-xr-x] | glances/glances.py | 99 | ||||
-rw-r--r--[-rwxr-xr-x] | i18n-gen.sh | 2 | ||||
-rw-r--r-- | messages.pot | 17 | ||||
-rwxr-xr-x | setup.py | 11 | ||||
-rw-r--r--[-rwxr-xr-x] | uninstall.sh | 7 |
15 files changed, 154 insertions, 161 deletions
diff --git a/MANIFEST.in b/MANIFEST.in index 36c36cd4..339ef4b4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,9 +1,7 @@ -include README -include COPYING include AUTHORS +include COPYING include NEWS -include screenshot.png +include README recursive-include doc *.png -recursive-include man *.1 recursive-include i18n *.mo -recursive-include glances *.html *.css *.png *.conf +recursive-include man *.1 @@ -52,130 +52,129 @@ Version 1.5 Version 1.4.2.2 =============== - * Add switch between bit/sec and byte/sec for network IO - * Add Changelog (generated with gitchangelog) + * Add switch between bit/sec and byte/sec for network IO + * Add Changelog (generated with gitchangelog) Version 1.4.2.1 =============== - * Minor patch to solve memomy issue (#94) on Mac OS X + * Minor patch to solve memomy issue (#94) on Mac OS X Version 1.4.2 ============= - * Use the news virtual_memory() and virtual_swap() fct (PsUtil) - * Display "Top process" in logs - * Minor patch on man page for Debian packaging - * Code optimization (less try and except) + * Use the news virtual_memory() and virtual_swap() fct (PsUtil) + * Display "Top process" in logs + * Minor patch on man page for Debian packaging + * Code optimization (less try and except) Version 1.4.1.1 =============== - * Minor patch to disable Process IO for OS X (not available in PsUtil) + * Minor patch to disable Process IO for OS X (not available in PsUtil) Version 1.4.1 ============= - * Per core CPU stats (if space is available) - * Add Process IO Read/Write information (if space is available) - * Uniformize units + * Per core CPU stats (if space is available) + * Add Process IO Read/Write information (if space is available) + * Uniformize units Version 1.4 =========== - * Goodby StatGrab... Welcome to the PsUtil library ! - * No more autotools, use setup.py to install (or package) - * Only major stats (CPU, Load and memory) use background colors - * Improve operating system name detection - * New system info: one-line layout and add Arch Linux support - * No decimal places for values < GB - * New memory and swap layout - * Add percentage of usage for both memory and swap - * Add MEM% usage, NICE, STATUS, UID, PID and running TIME per process - * Add sort by MEM% ('m' key) - * Add sort by Process name ('p' key) - * Multiple minor fixes, changes and improvements - * Disable Disk IO module from the command line (-d) - * Disable Mount module from the command line (-m) - * Disable Net rate module from the command line (-n) - * Improved FreeBSD support - * Cleaning code and style - * Code is now checked with pep8 - * CSV and HTML output (experimental functions, no yet documentation) + * Goodby StatGrab... Welcome to the PsUtil library ! + * No more autotools, use setup.py to install (or package) + * Only major stats (CPU, Load and memory) use background colors + * Improve operating system name detection + * New system info: one-line layout and add Arch Linux support + * No decimal places for values < GB + * New memory and swap layout + * Add percentage of usage for both memory and swap + * Add MEM% usage, NICE, STATUS, UID, PID and running TIME per process + * Add sort by MEM% ('m' key) + * Add sort by Process name ('p' key) + * Multiple minor fixes, changes and improvements + * Disable Disk IO module from the command line (-d) + * Disable Mount module from the command line (-m) + * Disable Net rate module from the command line (-n) + * Improved FreeBSD support + * Cleaning code and style + * Code is now checked with pep8 + * CSV and HTML output (experimental functions, no yet documentation) Version 1.3.7 ============= - * Display (if terminal space is available) an alerts history (logs) - * Add a limits classe to manage stats limits - * Manage black and white console (issue #31) + * Display (if terminal space is available) an alerts history (logs) + * Add a limits classe to manage stats limits + * Manage black and white console (issue #31) Version 1.3.6 ============= - * Add control before libs import - * Change static Python path (issue #20) - * Correct a bug with a network interface disaippear (issue #27) - * Add French and Spanish translation (thx to Jean Bob) + * Add control before libs import + * Change static Python path (issue #20) + * Correct a bug with a network interface disaippear (issue #27) + * Add French and Spanish translation (thx to Jean Bob) Version 1.3.5 ============= - * Add an help panel when Glances is running (key: 'h') - * Add keys descriptions in the syntax (--help | -h) + * Add an help panel when Glances is running (key: 'h') + * Add keys descriptions in the syntax (--help | -h) Version 1.3.4 ============= - * New key: 'n' to enable/disable network stats - * New key: 'd' to enable/disable disk IO stats - * New key: 'f' to enable/disable FS stats - * Reorganised the screen when stat are not available|disable - * Force Glances to use the enmbeded fs stats (issue #16) + * New key: 'n' to enable/disable network stats + * New key: 'd' to enable/disable disk IO stats + * New key: 'f' to enable/disable FS stats + * Reorganised the screen when stat are not available|disable + * Force Glances to use the enmbeded fs stats (issue #16) Version 1.3.3 ============= - * Automaticaly swith between process short and long name - * Center the host / system information - * Always put the hour/date in the bottom/right - * Correct a bug if there is a lot of Disk/IO - * Add control about available libstatgrab functions + * Automaticaly swith between process short and long name + * Center the host / system information + * Always put the hour/date in the bottom/right + * Correct a bug if there is a lot of Disk/IO + * Add control about available libstatgrab functions Version 1.3.2 ============= - * Add alert for network bit rate° - * Change the caption - * Optimised net, disk IO and fs display (share the space) - -° Disable on Ubuntu because the libstatgrab return a zero value - for the network interface speed. + * Add alert for network bit rate° + * Change the caption + * Optimised net, disk IO and fs display (share the space) + Disable on Ubuntu because the libstatgrab return a zero value + for the network interface speed. Version 1.3.1 ============= - * Add alert on load (depend on number of CPU core) - * Fix bug when the FS list is very long + * Add alert on load (depend on number of CPU core) + * Fix bug when the FS list is very long Version 1.3 =========== - * Add file system stats (total and used space) - * Adapt unit dynamicaly (K, M, G) - * Add man page (Thanks to Edouard Bourguignon) + * Add file system stats (total and used space) + * Adapt unit dynamicaly (K, M, G) + * Add man page (Thanks to Edouard Bourguignon) Version 1.2 =========== - * Resize the terminal and the windows are adapted dynamicaly - * Refresh screen instantanetly when a key is pressed + * Resize the terminal and the windows are adapted dynamicaly + * Refresh screen instantanetly when a key is pressed Version 1.1.3 ============= - * Add disk IO monitoring - * Add caption - * Correct a bug when computing the bitrate with the option -t - * Catch CTRL-C before init the screen (Bug #2) - * Check if mem.total = 0 before division (Bug #1) + * Add disk IO monitoring + * Add caption + * Correct a bug when computing the bitrate with the option -t + * Catch CTRL-C before init the screen (Bug #2) + * Check if mem.total = 0 before division (Bug #1) @@ -1,4 +1,5 @@ [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/thing/484466/nicolargoglances-on-GitHub) +[![Build Status](https://travis-ci.org/nicolargo/glances.png?branch=master)](https://travis-ci.org/nicolargo/glances) ============================= Glances -- Eye on your system @@ -16,11 +17,11 @@ It is developed in Python. Console (80x24) screenshot: -![screenshot](https://github.com/nicolargo/glances/raw/master/screenshot.png) +![screenshot](https://github.com/nicolargo/glances/raw/master/doc/screenshot.png) Wide terminal (> 90x24) screenshot: -![screenshot](https://github.com/nicolargo/glances/raw/master/screenshot-wide.png) +![screenshot](https://github.com/nicolargo/glances/raw/master/doc/screenshot-wide.png) ## Installation @@ -60,8 +61,8 @@ Note: if you are behind an HTTP Proxy, you should use instead: ### From [Homebrew](http://mxcl.github.com/homebrew/) for Mac OS X $ brew install brew-pip - $ export PYTHONPATH=$(brew --prefix)/lib/python2.7/site-packages - $ brew pip Glances + $ export PYTHONPATH=$(brew --prefix)/lib/python2.7/site-packages + $ brew pip Glances If you have the following error: @@ -103,9 +104,9 @@ Glances use a standard GNU style installer (for a Debian like system): $ sudo apt-get update $ sudo apt-get install python-setuptools build-essential python-dev $ cd /tmp - $ tar zxvf glances-last.tgz - $ cd nicolargo-glances-* - $ sudo python setup.py install + $ tar zxvf glances-last.tgz + $ cd nicolargo-glances-* + $ sudo python setup.py install ## Configuration @@ -134,7 +135,7 @@ On OS X, you should copy the configuration file to `~/Library/Application Suppor If you want to monitor your local machine, just run: - $ glances + $ glances ### In client/server mode @@ -167,7 +168,7 @@ The version 1.6 introduces a optionnal password to access to the server (-P pass By default, stats are refreshed every second, to change this setting, you can use the -t option. For example to set the refresh rate to 5 seconds: - $ glances -t 5 + $ glances -t 5 Importants stats are colored: @@ -1,4 +1,5 @@ [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/thing/484466/nicolargoglances-on-GitHub) +[![Build Status](https://travis-ci.org/nicolargo/glances.png?branch=master)](https://travis-ci.org/nicolargo/glances) ============================= Glances -- Eye on your system @@ -16,11 +17,11 @@ It is developed in Python. Console (80x24) screenshot: -![screenshot](https://github.com/nicolargo/glances/raw/master/screenshot.png) +![screenshot](https://github.com/nicolargo/glances/raw/master/doc/screenshot.png) Wide terminal (> 90x24) screenshot: -![screenshot](https://github.com/nicolargo/glances/raw/master/screenshot-wide.png) +![screenshot](https://github.com/nicolargo/glances/raw/master/doc/screenshot-wide.png) ## Installation @@ -60,8 +61,8 @@ Note: if you are behind an HTTP Proxy, you should use instead: ### From [Homebrew](http://mxcl.github.com/homebrew/) for Mac OS X $ brew install brew-pip - $ export PYTHONPATH=$(brew --prefix)/lib/python2.7/site-packages - $ brew pip Glances + $ export PYTHONPATH=$(brew --prefix)/lib/python2.7/site-packages + $ brew pip Glances If you have the following error: @@ -103,9 +104,9 @@ Glances use a standard GNU style installer (for a Debian like system): $ sudo apt-get update $ sudo apt-get install python-setuptools build-essential python-dev $ cd /tmp - $ tar zxvf glances-last.tgz - $ cd nicolargo-glances-* - $ sudo python setup.py install + $ tar zxvf glances-last.tgz + $ cd nicolargo-glances-* + $ sudo python setup.py install ## Configuration @@ -134,7 +135,7 @@ On OS X, you should copy the configuration file to `~/Library/Application Suppor If you want to monitor your local machine, just run: - $ glances + $ glances ### In client/server mode @@ -167,7 +168,7 @@ The version 1.6 introduces a optionnal password to access to the server (-P pass By default, stats are refreshed every second, to change this setting, you can use the -t option. For example to set the refresh rate to 5 seconds: - $ glances -t 5 + $ glances -t 5 Importants stats are colored: diff --git a/screenshot-wide.png b/doc/screenshot-wide.png Binary files differindex 223c06f8..223c06f8 100644 --- a/screenshot-wide.png +++ b/doc/screenshot-wide.png diff --git a/screenshot.png b/doc/screenshot.png Binary files differindex 5b8f6bb4..5b8f6bb4 100644 --- a/screenshot.png +++ b/doc/screenshot.png diff --git a/glances/css/default.css b/glances/data/css/default.css index 7f4ac371..7f4ac371 100644 --- a/glances/css/default.css +++ b/glances/data/css/default.css diff --git a/glances/html/base.html b/glances/data/html/base.html index 56779ad8..56779ad8 100644 --- a/glances/html/base.html +++ b/glances/data/html/base.html diff --git a/glances/html/default.html b/glances/data/html/default.html index 2face6ef..2face6ef 100644 --- a/glances/html/default.html +++ b/glances/data/html/default.html diff --git a/glances/img/bg.png b/glances/data/img/bg.png Binary files differindex 3b0bb7e3..3b0bb7e3 100644 --- a/glances/img/bg.png +++ b/glances/data/img/bg.png diff --git a/glances/glances.py b/glances/glances.py index 5745804f..ebd19ac6 100755..100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -2871,23 +2871,25 @@ class glancesHtml: """ This class manages the HTML output """ - - def __init__(self, htmlfolder="/usr/share", refresh_time=1): - # Global information to display - - # Init refresh time + def __init__(self, html_path, refresh_time=1): + html_filename = 'glances.html' + html_template = 'default.html' self.__refresh_time = refresh_time - # Set the root path - self.root_path = htmlfolder + '/' + # Set the HTML output file + self.html_file = os.path.join(html_path, html_filename) + + # Get the working path + self.work_path = self.get_work_path() # Set the templates path + template_path = os.path.join(self.work_path, 'html') environment = jinja2.Environment( - loader=jinja2.FileSystemLoader(os.path.dirname(__file__) + '/html'), + loader=jinja2.FileSystemLoader(template_path), extensions=['jinja2.ext.loopcontrols']) # Open the template - self.template = environment.get_template('default.html') + self.template = environment.get_template(html_template) # Define the colors list (hash table) for logged stats self.__colors_list = { @@ -2899,6 +2901,27 @@ class glancesHtml: 'CRITICAL': "bgcritical fgcritical" } + def get_work_path(self): + """ + Get the working path + + The data files will be searched in the following paths: + * /path/to/glances/glances/data + * {/usr,/usr/local}/share/glances (Linux or *BSD/OS X) + """ + base_path = os.path.dirname(os.path.abspath(__file__)) + local_path = os.path.join(base_path, 'data') + share_path = os.path.join(sys.prefix, 'share', __appname__) + + if os.path.exists(local_path): + work_path = local_path # running from local directory + elif os.path.exists(share_path): + work_path = share_path # running from system directory + else: + work_path = "" + + return work_path + def __getAlert(self, current=0, max=100): # If current < CAREFUL of max then alert = OK # If current > CAREFUL of max then alert = CAREFUL @@ -2974,30 +2997,26 @@ class glancesHtml: def update(self, stats): if stats.getCpu(): # Open the output file - f = open(self.root_path + 'glances.html', 'w') - - # Process color - - # Render it - # HTML Refresh is set to 1.5 * refresh_time - # ... to avoid display while page rendering - data = self.template.render( - refresh=int(self.__refresh_time * 1.5), - host=stats.getHost(), - system=stats.getSystem(), - cpu=self.__getCpuColor(stats.getCpu()), - load=self.__getLoadColor(stats.getLoad(), stats.getCore()), - core=stats.getCore(), - mem=self.__getMemColor(stats.getMem()), - memswap=self.__getMemSwapColor(stats.getMemSwap()), - net=stats.getNetwork(), - diskio=stats.getDiskIO(), - fs=self.__getFsColor(stats.getFs()), - proccount=stats.getProcessCount(), - proclist=stats.getProcessList()) - - # Write data into the file - f.write(data) + with open(self.html_file, 'w') as f: + # HTML refresh is set to 1.5 * refresh_time + # to avoid display while page rendering + data = self.template.render( + refresh=int(self.__refresh_time * 1.5), + host=stats.getHost(), + system=stats.getSystem(), + cpu=self.__getCpuColor(stats.getCpu()), + load=self.__getLoadColor(stats.getLoad(), stats.getCore()), + core=stats.getCore(), + mem=self.__getMemColor(stats.getMem()), + memswap=self.__getMemSwapColor(stats.getMemSwap()), + net=stats.getNetwork(), + diskio=stats.getDiskIO(), + fs=self.__getFsColor(stats.getFs()), + proccount=stats.getProcessCount(), + proclist=stats.getProcessList()) + + # Write data into the file + f.write(data) # Close the file f.close() @@ -3019,7 +3038,7 @@ class glancesCsv: self.__cvsfile_fd = open("%s" % cvsfile, "wb") self.__csvfile = csv.writer(self.__cvsfile_fd) except IOError as error: - print("Can not create the output CSV file: ", error[1]) + print("Cannot create the output CSV file: ", error[1]) sys.exit(0) def exit(self): @@ -3472,18 +3491,18 @@ def main(): # Check options if server_tag: if client_tag: - print(_("Error: Can not use both -s and -c flag")) + print(_("Error: Cannot use both -s and -c flag")) sys.exit(2) if html_tag or csv_tag: - print(_("Error: Can not use both -s and -o flag")) + print(_("Error: Cannot use both -s and -o flag")) sys.exit(2) if client_tag: if html_tag or csv_tag: - print(_("Error: Can not use both -c and -o flag")) + print(_("Error: Cannot use both -c and -o flag")) sys.exit(2) if conf_file_tag: - print(_("Error: Can not use both -c and -C flag")) + print(_("Error: Cannot use both -c and -C flag")) print(_(" Limits are set based on the server ones")) sys.exit(2) @@ -3495,7 +3514,7 @@ def main(): try: output_folder except UnboundLocalError: - print(_("Error: HTML export (-o html) need" + print(_("Error: HTML export (-o html) need " "output folder definition (-f <folder>)")) sys.exit(2) @@ -3579,7 +3598,7 @@ def main(): # Init HTML output if html_tag: - htmloutput = glancesHtml(htmlfolder=output_folder, + htmloutput = glancesHtml(html_path=output_folder, refresh_time=refresh_time) # Init CSV output diff --git a/i18n-gen.sh b/i18n-gen.sh index 4de116f2..4bdd4834 100755..100644 --- a/i18n-gen.sh +++ b/i18n-gen.sh @@ -15,6 +15,6 @@ xgettext --language=Python --keyword=_ --output=./i18n/glances.pot ./glances/gla for i in `echo $LANG_LIST` do echo "Generate language pack for: $i" - msgmerge --update --no-fuzzy-matching --backup=off ./i18n/$i/LC_MESSAGES/glances.po ./i18n/glances.pot + msgmerge --update --no-fuzzy-matching --backup=off ./i18n/$i/LC_MESSAGES/glances.po ./i18n/glances.pot msgfmt ./i18n/$i/LC_MESSAGES/glances.po --output-file ./i18n/$i/LC_MESSAGES/glances.mo done diff --git a/messages.pot b/messages.pot deleted file mode 100644 index a2a59b65..00000000 --- a/messages.pot +++ /dev/null @@ -1,17 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR ORGANIZATION -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2012-09-08 10:33+CEST\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: ENCODING\n" -"Generated-By: pygettext.py 1.5\n" - - @@ -8,16 +8,15 @@ from setuptools import setup data_files = [ ('share/man/man1', ['man/glances.1']), - ('share/doc/glances', ['README', + ('share/doc/glances', ['AUTHORS', 'COPYING', - 'AUTHORS', 'NEWS', - 'screenshot.png', + 'README', 'glances/conf/glances.conf']), ('share/doc/glances/doc', glob.glob('doc/*.png')), - ('share/glances/html', glob.glob('glances/html/*.html')), - ('share/glances/css', glob.glob('glances/css/*.css')), - ('share/glances/img', glob.glob('glances/img/*.png')), + ('share/glances/css', glob.glob('glances/data/css/*.css')), + ('share/glances/html', glob.glob('glances/data/html/*.html')), + ('share/glances/img', glob.glob('glances/data/img/*.png')), ] if hasattr(sys, 'real_prefix') or ('bsd' or 'darwin' in sys.platform): diff --git a/uninstall.sh b/uninstall.sh index 82515a15..5597ec1d 100755..100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -20,10 +20,3 @@ done echo -e "\n\n* SUCCESS: Uninstall complete." rm install.record - - - - - - - |