Skip to content

Commit

Permalink
Moving code into module and added unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
RhetTbull committed Dec 15, 2018
0 parents commit 23ac288
Show file tree
Hide file tree
Showing 8 changed files with 677 additions and 0 deletions.
9 changes: 9 additions & 0 deletions AUTHOR.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# osxmetadata Authors

## Rhet Turnbull

* Personal website: https://github.com/RhetTbull
* EMail: rturnbull+git [:AT:] gmail [:DOT:] com
* Location: California, USA
* Twitter: @RhetTurnbull
* Github: RhetTbull
29 changes: 29 additions & 0 deletions COPYING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright

Copyright © 2018, Rhet Turnbull <[rturnbull+git@gmail.com](https://github.com/RhetTbull)><br>
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

<span><!-- To avoid code block getting part of the list --></span>

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### License ###

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
osxmetadata [![Build Status]()](https://github.com/RhetTbull/osxmetadata)
========

What is osxmetadata?
-----------------

zzz OSDetect is a small python module which is able to get some information
about your system and python implementation, like the Operating System
or the hardware platform.

Supported operating systems
---------------------------

As of now, only GNU/Linux, Mac OS X, Windows NT and Windows NT/Cygwin are supported. At the
moment, I'm working on support for a wider range of operating systems.

Since version 1.1.0, Python 2 and Python 3 are both supported.

Note that the information available on the different platforms may differ.

Installation instructions
-------------------------

Since OSDetect uses setuptools, you simply need to run

python setup.py install

Command Line Usage
------------------

OSDetect includes a function which is executed if the module is directly called. So give it
a try and run:

python -m OSDetect

Example uses of the module
--------------------------

```python
# Get a dict containing all gathered information
from OSDetect import info as os_info
print(os_info.getInfo())

# Get a specific value
print(os_info.getDistribution())
# or using the dict key (a dot means a dict containing a dict)
print(os_info.get("Python.Version"))
```

On a ArchLinux system, it looks like this:

```python
{
'Python': {
'Version': '3.6.0',
'Implementation': 'CPython'
},
'Machine': 'i686',
'OS': 'Linux',
'OSVersion': '4.10.6-1-ARCH',
'Distribution': 'Arch Linux'
}

'ArchLinux'
'3.6.0'
```

0 comments on commit 23ac288

Please sign in to comment.