This repository has been archived by the owner on Nov 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 95d0659
Showing
13 changed files
with
267 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
syntax: glob | ||
*pyc | ||
*~ | ||
*egg-info | ||
dist | ||
*orig | ||
*nja |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
OnlineGroups.Net and Contributors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Zope Public License (ZPL) Version 2.1 | ||
|
||
A copyright notice accompanies this license document that identifies the | ||
copyright holders. | ||
|
||
This license has been certified as open source. It has also been designated as | ||
GPL compatible by the Free Software Foundation (FSF). | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions in source code must retain the accompanying copyright | ||
notice, this list of conditions, and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the accompanying copyright | ||
notice, this list of conditions, and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
3. Names of the copyright holders must not be used to endorse or promote | ||
products derived from this software without prior written permission from the | ||
copyright holders. | ||
|
||
4. The right to distribute this software or to use it for any purpose does not | ||
give you the right to use Servicemarks (sm) or Trademarks (tm) of the | ||
copyright | ||
holders. Use of them is covered by separate agreement with the copyright | ||
holders. | ||
|
||
5. If any files are modified, you must cause the modified files to carry | ||
prominent notices stating that you changed the files and the date of any | ||
change. | ||
|
||
Disclaimer | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED | ||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
recursive-include gs * | ||
recursive-include docs * | ||
include version.py | ||
include *.txt | ||
include *.rst | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
================== | ||
``gs.profile.log`` | ||
================== | ||
--------------------------- | ||
Profile log for GroupServer | ||
--------------------------- | ||
|
||
:Author: `Michael JasonSmith`_ | ||
:Contact: Michael JasonSmith <[email protected]> | ||
:Date: 2016-01-29 | ||
:Organization: `GroupServer.org`_ | ||
:Copyright: This document is licensed under a | ||
`Creative Commons Attribution-Share Alike 4.0 International License`_ | ||
by `OnlineGroups.net`_. | ||
|
||
.. _Creative Commons Attribution-Share Alike 4.0 International License: | ||
http://creativecommons.org/licenses/by-sa/4.0/ | ||
|
||
Introduction | ||
============ | ||
|
||
GroupServer records events in the ``audit_event`` table | ||
[#audit]. This product provides the page ``log.html`` in the | ||
*profile* context that provides a view of these events for a | ||
person. | ||
|
||
Resources | ||
========= | ||
|
||
- Code repository: https://github.com/groupserver/gs.profile.log | ||
- Questions and comments to | ||
http://groupserver.org/groups/development | ||
- Report bugs at https://redmine.iopen.net/projects/groupserver | ||
|
||
.. _GroupServer: http://groupserver.org/ | ||
.. _GroupServer.org: http://groupserver.org/ | ||
.. _OnlineGroups.Net: https://onlinegroups.net | ||
.. _Michael JasonSmith: http://groupserver.org/p/mpj17 | ||
|
||
.. [#audit] See | ||
<https://github.com/groupserver/Products.GSAuditTrail> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Changelog | ||
========== | ||
|
||
1.0.0 (2016-01-29) | ||
------------------ | ||
|
||
Initial version. Prior to the creation of this product the | ||
audit-event log was provided by `Products.GSProfile`_. | ||
|
||
.. _Products.GSProfile: | ||
https://github.com/groupserver/Products.GSProfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages | ||
try: | ||
__import__('pkg_resources').declare_namespace(__name__) | ||
except ImportError: | ||
from pkgutil import extend_path | ||
__path__ = extend_path(__path__, __name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages | ||
try: | ||
__import__('pkg_resources').declare_namespace(__name__) | ||
except ImportError: | ||
from pkgutil import extend_path | ||
__path__ = extend_path(__path__, __name__) |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[sdist] | ||
formats = zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################ | ||
# | ||
# Copyright © 2016 OnlineGroups.net and Contributors. | ||
# All Rights Reserved. | ||
# | ||
# This software is subject to the provisions of the Zope Public License, | ||
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | ||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | ||
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS | ||
# FOR A PARTICULAR PURPOSE. | ||
# | ||
############################################################################ | ||
import codecs | ||
import os | ||
import sys | ||
from setuptools import setup, find_packages | ||
from version import get_version | ||
|
||
name = 'gs.profile.log' | ||
version = get_version() | ||
|
||
with codecs.open('README.rst', encoding='utf-8') as f: | ||
long_description = f.read() | ||
with codecs.open(os.path.join("docs", "HISTORY.rst"), | ||
encoding='utf-8') as f: | ||
long_description += '\n' + f.read() | ||
|
||
requires = [ | ||
'setuptools', | ||
'pytz', | ||
'zope.browserpage', | ||
'gs.profile.base', | ||
'Products.GSAuditTrail', | ||
] | ||
|
||
setup( | ||
name=name, | ||
version=version, | ||
description="Profile log for GroupServer audit-events.", | ||
long_description=long_description, | ||
classifiers=[ | ||
'Development Status :: 5 - Production', | ||
"Intended Audience :: Developers", | ||
'License :: OSI Approved :: Zope Public License', | ||
"Natural Language :: English", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 2", | ||
"Programming Language :: Python :: 2.7", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
], | ||
keywords='profile, user, GroupServer', | ||
author='Michael JasonSmith', | ||
author_email='[email protected]', | ||
url='https://github.com/groupserver/{0}'.format(name), | ||
license='ZPL 2.1', | ||
packages=find_packages(exclude=['ez_setup']), | ||
namespace_packages=['.'.join(name.split('.')[:i]) | ||
for i in range(1, len(name.split('.')))], | ||
include_package_data=True, | ||
zip_safe=False, | ||
install_requires=requires, | ||
entry_points=""" | ||
# -*- Entry points: -*- | ||
""",) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# -*- coding: utf-8 -*- | ||
version = '3.1.0' | ||
release = False | ||
|
||
#--------------------------------------------------------------------------# | ||
import sys | ||
if (sys.version_info < (3, )): | ||
from commands import getstatusoutput | ||
else: | ||
from subprocess import getstatusoutput # lint:ok | ||
import datetime | ||
import os | ||
import glob | ||
|
||
|
||
class CommandError(Exception): | ||
pass | ||
|
||
|
||
def execute_command(commandstring): | ||
status, output = getstatusoutput(commandstring) | ||
if status != 0: | ||
m = 'Command "{0}" exited with status {1}' | ||
msg = m.format(commandstring, status) | ||
raise CommandError(msg) | ||
return output | ||
|
||
|
||
def parse_version_from_package(): | ||
try: | ||
pkginfo = os.path.join(glob.glob('*.egg-info')[0], | ||
'PKG-INFO') | ||
except: | ||
pkginfo = '' | ||
|
||
version_string = '' | ||
if os.path.exists(pkginfo): | ||
for line in open(pkginfo): | ||
if line.find('Version: ') == 0: | ||
version_string = line.strip().split('Version: ')[1].strip() | ||
if not version_string: | ||
version_string = '%s-dev' % version | ||
else: | ||
version_string = version | ||
|
||
return version_string | ||
|
||
|
||
def get_version(): | ||
try: | ||
globalid = execute_command("hg identify -i").strip('+') | ||
c = "hg log -r %s --template '{date|isodatesec}'" % globalid | ||
commitdate = execute_command(c) | ||
# convert date to UTC unix timestamp, using the date command because | ||
# python date libraries do not stabilise till about 2.6 | ||
dateCommand = 'date -d"%s" --utc +%%s' % commitdate | ||
timestamp = int(execute_command(dateCommand)) | ||
|
||
# finally we have something we can use! | ||
dt = datetime.datetime.utcfromtimestamp(timestamp) | ||
datestring = dt.strftime('%Y%m%d%H%M%S') | ||
if release: | ||
version_string = version | ||
else: | ||
version_string = "%s.dev%s" % (version, datestring) | ||
|
||
except (CommandError, ValueError, TypeError): | ||
# --=mpj17=-- Usually because we are building out a source-egg, | ||
# rather than from a Hg source-directory. | ||
version_string = parse_version_from_package() | ||
|
||
return version_string | ||
|
||
if __name__ == '__main__': | ||
import sys | ||
sys.stdout.write('{0}\n'.format(get_version())) |