-
Notifications
You must be signed in to change notification settings - Fork 1
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 bdffde8
Showing
26 changed files
with
1,248 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,5 @@ | ||
--ignore-dir=build | ||
--ignore-dir=dist | ||
--ignore-dir=venv | ||
--ignore-dir=venv-3 | ||
--ignore-dir=fileperms.egg-info |
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 @@ | ||
source /Users/mysz/Projects/pychmod/venv-3/bin/activate |
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,66 @@ | ||
### python template | ||
/venv | ||
/venv-* | ||
*.pyc | ||
/.idea### Python template | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
/.idea | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Created by .ignore support plugin (hsz.mobi) |
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,43 @@ | ||
[versionner] | ||
file = ./VERSION | ||
;up_part= patch | ||
;default_init_version = 1.0.0 | ||
;default_increase_value = 1 | ||
|
||
[vcs] | ||
engine = git | ||
tag = yes | ||
tag_params = | ||
commit_message = '%(version)s' | ||
|
||
[file:fileperms/__init__.py] | ||
enabled = true | ||
match = line | ||
search = ^\s*__version__\s*=.*$ | ||
replace = __version__ = '%(version)s' | ||
|
||
[file:setup.py] | ||
enabled = true | ||
match = line | ||
search = \bversion\s*=.*$ | ||
replace = version='%(version)s', | ||
encoding = utf-8 | ||
|
||
[file:README.md] | ||
enabled = true | ||
match = file | ||
search = \nCurrent stable version | ||
---------------------- | ||
\s+[\w.-]+\n | ||
replace = \nCurrent stable version | ||
---------------------- | ||
|
||
%(version)s\n | ||
encoding = utf-8 | ||
|
||
[file:2:README.md] | ||
enabled = true | ||
match = line | ||
search = \b\d+\.\d+\.\d+\.zip\b | ||
replace = %(version)s.zip | ||
encoding = utf-8 |
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,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Marcin Sztolcman | ||
|
||
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. | ||
|
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,17 @@ | ||
doc: | ||
pandoc --from=markdown --to=rst --output="README.rst" "README.md" | ||
|
||
clean: | ||
rm dist/* || true | ||
rm -fr __pycache__ || true | ||
rm -fr fileperms/__pycache__ || true | ||
rm -fr build || true | ||
|
||
build: | ||
python3 setup.py sdist | ||
python3 setup.py bdist_wheel | ||
|
||
upload: | ||
twine upload dist/fileperms* | ||
|
||
distro: clean build upload |
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,127 @@ | ||
fileperms | ||
========== | ||
|
||
`fileperms` is small library for describing file permissions. | ||
|
||
Current stable version | ||
---------------------- | ||
|
||
1.0.0 | ||
|
||
Features | ||
-------- | ||
|
||
* easy manipulating of permissions | ||
* works fine with `os.chmod` and `pathlib.Path` | ||
|
||
Python version | ||
-------------- | ||
|
||
`fileperms` works only with Python 3.3+. Older Python versions are unsupported. | ||
|
||
Some examples | ||
------------- | ||
|
||
>>> import fileperms | ||
>>> fileperms.Permissions.from_path('/etc') | ||
<Permissions(0755)> | ||
>>> import os, stat | ||
>>> print(stat.filemode(os.stat(path).st_mode)) | ||
-rw------- | ||
>>> prm = fileperms.Permissions.from_path(path) | ||
>>> prm | ||
<Permissions(0600)> | ||
>>> prm.to_filemode() | ||
'rw-------' | ||
>>> prm.owner_exec = True | ||
>>> prm.other_exec = True | ||
>>> os.chmod(path, prm) | ||
>>> print(stat.filemode(os.stat(path).st_mode)) | ||
-rwx-----x | ||
|
||
>>> import pathlib | ||
>>> path = pathlib.Path(path) | ||
>>> prm.group_read = True | ||
>>> prm.group_write = True | ||
>>> path.chmod(prm) | ||
>>> print(stat.filemode(path.stat().st_mode)) | ||
-rwxrw---x | ||
|
||
Installation | ||
------------ | ||
|
||
1. Using PIP | ||
|
||
`fileperms` should work on any platform where [Python](http://python.org) | ||
is available, it means Linux, Windows, MacOS X etc, but is not tested on Windows. | ||
|
||
Simplest way is to use Python's built-in package system: | ||
|
||
pip3 install fileperms | ||
|
||
2. Using sources | ||
|
||
Download sources from [Github](https://github.com/msztolcman/fileperms/archive/1.0.0.zip): | ||
|
||
wget -O 1.0.0.zip https://github.com/msztolcman/fileperms/archive/1.0.0.zip | ||
|
||
or | ||
|
||
curl -o 1.0.0.zip https://github.com/msztolcman/fileperms/archive/1.0.0.zip | ||
|
||
Unpack: | ||
|
||
unzip 1.0.0.zip | ||
|
||
And install | ||
|
||
cd fileperms-1.0.0 | ||
python3 setup.py install | ||
|
||
Voila! | ||
|
||
Authors | ||
------- | ||
|
||
Marcin Sztolcman <marcin@urzenia.net> | ||
|
||
Contact | ||
------- | ||
|
||
If you like or dislike this software, please do not hesitate to tell me about | ||
this me via email (marcin@urzenia.net). | ||
|
||
If you find bug or have an idea to enhance this tool, please use GitHub's | ||
[issues](https://github.com/msztolcman/fileperms/issues). | ||
|
||
License | ||
------- | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Marcin Sztolcman | ||
|
||
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. | ||
|
||
ChangeLog | ||
--------- | ||
|
||
### v1.0.0 | ||
|
||
* first public version |
Oops, something went wrong.