lscom 0.0.4__tar.gz → 0.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lscom-0.0.4 → lscom-0.0.5}/LICENSE +21 -21
- {lscom-0.0.4 → lscom-0.0.5}/PKG-INFO +74 -74
- {lscom-0.0.4 → lscom-0.0.5}/README.md +42 -42
- {lscom-0.0.4 → lscom-0.0.5}/lscom/__init__.py +4 -4
- {lscom-0.0.4 → lscom-0.0.5}/lscom/__main__.py +56 -56
- {lscom-0.0.4 → lscom-0.0.5}/lscom/__version__.py +14 -14
- {lscom-0.0.4 → lscom-0.0.5}/lscom/app.py +111 -110
- {lscom-0.0.4 → lscom-0.0.5}/lscom.egg-info/PKG-INFO +74 -74
- lscom-0.0.5/pyproject.toml +2 -0
- {lscom-0.0.4 → lscom-0.0.5}/setup.cfg +4 -4
- {lscom-0.0.4 → lscom-0.0.5}/setup.py +66 -66
- lscom-0.0.4/pyproject.toml +0 -2
- {lscom-0.0.4 → lscom-0.0.5}/lscom.egg-info/SOURCES.txt +0 -0
- {lscom-0.0.4 → lscom-0.0.5}/lscom.egg-info/dependency_links.txt +0 -0
- {lscom-0.0.4 → lscom-0.0.5}/lscom.egg-info/entry_points.txt +0 -0
- {lscom-0.0.4 → lscom-0.0.5}/lscom.egg-info/requires.txt +0 -0
- {lscom-0.0.4 → lscom-0.0.5}/lscom.egg-info/top_level.txt +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Josh Schmelzle
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Josh Schmelzle
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: lscom
|
|
3
|
-
Version: 0.0.
|
|
4
|
-
Summary: list available active COM ports
|
|
5
|
-
Home-page: https://github.com/joshschmelzle/lscom
|
|
6
|
-
Author: Josh Schmelzle
|
|
7
|
-
Author-email: josh@joshschmelzle.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Keywords: com,com ports,serial
|
|
10
|
-
Classifier: Natural Language :: English
|
|
11
|
-
Classifier: Development Status :: 3 - Alpha
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.2
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: Intended Audience :: System Administrators
|
|
15
|
-
Classifier: Topic :: Utilities
|
|
16
|
-
Requires-Python: >3.2,
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
License-File: LICENSE
|
|
19
|
-
Requires-Dist: pyserial
|
|
20
|
-
Dynamic: author
|
|
21
|
-
Dynamic: author-email
|
|
22
|
-
Dynamic: classifier
|
|
23
|
-
Dynamic: description
|
|
24
|
-
Dynamic: description-content-type
|
|
25
|
-
Dynamic: home-page
|
|
26
|
-
Dynamic: keywords
|
|
27
|
-
Dynamic: license
|
|
28
|
-
Dynamic: license-file
|
|
29
|
-
Dynamic: requires-dist
|
|
30
|
-
Dynamic: requires-python
|
|
31
|
-
Dynamic: summary
|
|
32
|
-
|
|
33
|
-
    [](https://github.com/joshschmelzle/lscom/blob/main/CODE_OF_CONDUCT.md)
|
|
34
|
-
|
|
35
|
-
# lscom: list and discover available COM ports
|
|
36
|
-
|
|
37
|
-
More quickly identify which COM ports are available for use. Any COM ports already in use will not be listed. `lscom` should work cross platform (Linux, macOS, Windows), but has not been extensively tested. Have a problem? Open an issue.
|
|
38
|
-
|
|
39
|
-
## Usage Example
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
$ lscom
|
|
43
|
-
['COM3']
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Installation from PyPI
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
python -m pip install lscom
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Local Installation Example
|
|
53
|
-
|
|
54
|
-
To install manually:
|
|
55
|
-
|
|
56
|
-
1. Clone repository.
|
|
57
|
-
|
|
58
|
-
2. Open the terminal to the root of the repository.
|
|
59
|
-
|
|
60
|
-
3. Run-
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
python -m pip install .
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
You should now be able to run `lscom` from your terminal
|
|
67
|
-
|
|
68
|
-
If you can't, check and make sure the scripts directory is included in the system path environment variable.
|
|
69
|
-
|
|
70
|
-
To remove:
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
python -m pip uninstall lscom
|
|
74
|
-
```
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lscom
|
|
3
|
+
Version: 0.0.5
|
|
4
|
+
Summary: list available active COM ports
|
|
5
|
+
Home-page: https://github.com/joshschmelzle/lscom
|
|
6
|
+
Author: Josh Schmelzle
|
|
7
|
+
Author-email: josh@joshschmelzle.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: com,com ports,serial
|
|
10
|
+
Classifier: Natural Language :: English
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.2
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: Topic :: Utilities
|
|
16
|
+
Requires-Python: >3.2,
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: pyserial
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: author-email
|
|
22
|
+
Dynamic: classifier
|
|
23
|
+
Dynamic: description
|
|
24
|
+
Dynamic: description-content-type
|
|
25
|
+
Dynamic: home-page
|
|
26
|
+
Dynamic: keywords
|
|
27
|
+
Dynamic: license
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
Dynamic: requires-dist
|
|
30
|
+
Dynamic: requires-python
|
|
31
|
+
Dynamic: summary
|
|
32
|
+
|
|
33
|
+
    [](https://github.com/joshschmelzle/lscom/blob/main/CODE_OF_CONDUCT.md)
|
|
34
|
+
|
|
35
|
+
# lscom: list and discover available COM ports
|
|
36
|
+
|
|
37
|
+
More quickly identify which COM ports are available for use. Any COM ports already in use will not be listed. `lscom` should work cross platform (Linux, macOS, Windows), but has not been extensively tested. Have a problem? Open an issue.
|
|
38
|
+
|
|
39
|
+
## Usage Example
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
$ lscom
|
|
43
|
+
['COM3']
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Installation from PyPI
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python -m pip install lscom
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Local Installation Example
|
|
53
|
+
|
|
54
|
+
To install manually:
|
|
55
|
+
|
|
56
|
+
1. Clone repository.
|
|
57
|
+
|
|
58
|
+
2. Open the terminal to the root of the repository.
|
|
59
|
+
|
|
60
|
+
3. Run-
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
python -m pip install .
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
You should now be able to run `lscom` from your terminal
|
|
67
|
+
|
|
68
|
+
If you can't, check and make sure the scripts directory is included in the system path environment variable.
|
|
69
|
+
|
|
70
|
+
To remove:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python -m pip uninstall lscom
|
|
74
|
+
```
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
    [](https://github.com/joshschmelzle/lscom/blob/main/CODE_OF_CONDUCT.md)
|
|
2
|
-
|
|
3
|
-
# lscom: list and discover available COM ports
|
|
4
|
-
|
|
5
|
-
More quickly identify which COM ports are available for use. Any COM ports already in use will not be listed. `lscom` should work cross platform (Linux, macOS, Windows), but has not been extensively tested. Have a problem? Open an issue.
|
|
6
|
-
|
|
7
|
-
## Usage Example
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
$ lscom
|
|
11
|
-
['COM3']
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Installation from PyPI
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
python -m pip install lscom
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Local Installation Example
|
|
21
|
-
|
|
22
|
-
To install manually:
|
|
23
|
-
|
|
24
|
-
1. Clone repository.
|
|
25
|
-
|
|
26
|
-
2. Open the terminal to the root of the repository.
|
|
27
|
-
|
|
28
|
-
3. Run-
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
python -m pip install .
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
You should now be able to run `lscom` from your terminal
|
|
35
|
-
|
|
36
|
-
If you can't, check and make sure the scripts directory is included in the system path environment variable.
|
|
37
|
-
|
|
38
|
-
To remove:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
python -m pip uninstall lscom
|
|
42
|
-
```
|
|
1
|
+
    [](https://github.com/joshschmelzle/lscom/blob/main/CODE_OF_CONDUCT.md)
|
|
2
|
+
|
|
3
|
+
# lscom: list and discover available COM ports
|
|
4
|
+
|
|
5
|
+
More quickly identify which COM ports are available for use. Any COM ports already in use will not be listed. `lscom` should work cross platform (Linux, macOS, Windows), but has not been extensively tested. Have a problem? Open an issue.
|
|
6
|
+
|
|
7
|
+
## Usage Example
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
$ lscom
|
|
11
|
+
['COM3']
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Installation from PyPI
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
python -m pip install lscom
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Local Installation Example
|
|
21
|
+
|
|
22
|
+
To install manually:
|
|
23
|
+
|
|
24
|
+
1. Clone repository.
|
|
25
|
+
|
|
26
|
+
2. Open the terminal to the root of the repository.
|
|
27
|
+
|
|
28
|
+
3. Run-
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
python -m pip install .
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
You should now be able to run `lscom` from your terminal
|
|
35
|
+
|
|
36
|
+
If you can't, check and make sure the scripts directory is included in the system path environment variable.
|
|
37
|
+
|
|
38
|
+
To remove:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
python -m pip uninstall lscom
|
|
42
|
+
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
# | _ _ _ ._ _
|
|
4
|
-
# | _> (_ (_) | | |
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# | _ _ _ ._ _
|
|
4
|
+
# | _> (_ (_) | | |
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
# | _ _ _ ._ _
|
|
4
|
-
# | _> (_ (_) | | |
|
|
5
|
-
|
|
6
|
-
"""
|
|
7
|
-
lscom
|
|
8
|
-
~~~~~
|
|
9
|
-
|
|
10
|
-
list available serial ports
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
import argparse
|
|
14
|
-
import sys
|
|
15
|
-
|
|
16
|
-
from lscom.__version__ import __title__, __version__
|
|
17
|
-
from lscom.app import run
|
|
18
|
-
|
|
19
|
-
PY_MAJOR = 3
|
|
20
|
-
PY_MINOR = 2
|
|
21
|
-
MINIMUM_PYTHON_VERISON = "3.2"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def check_python_version(): # type: ignore
|
|
25
|
-
"""Use old-school .format() method for if someone uses with very old Python."""
|
|
26
|
-
msg = """
|
|
27
|
-
|
|
28
|
-
{title} version {pkgv} requires Python version {pyv} or higher.
|
|
29
|
-
""".format(
|
|
30
|
-
title=__title__, pkgv=__version__, pyv=MINIMUM_PYTHON_VERISON
|
|
31
|
-
)
|
|
32
|
-
if sys.version_info < (PY_MAJOR, PY_MINOR):
|
|
33
|
-
raise ValueError(msg)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def main():
|
|
37
|
-
parser = argparse.ArgumentParser(
|
|
38
|
-
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
39
|
-
description="lscom: list and discover available COM ports",
|
|
40
|
-
epilog="Made with Python by Josh Schmelzle",
|
|
41
|
-
)
|
|
42
|
-
parser.add_argument(
|
|
43
|
-
"--version", "-v", action="version", version=f"lscom version {__version__}"
|
|
44
|
-
)
|
|
45
|
-
args = parser.parse_args() # noqa: F841
|
|
46
|
-
run()
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def init():
|
|
50
|
-
check_python_version() # type: ignore
|
|
51
|
-
|
|
52
|
-
if __name__ == "__main__":
|
|
53
|
-
sys.exit(main())
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
init()
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# | _ _ _ ._ _
|
|
4
|
+
# | _> (_ (_) | | |
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
lscom
|
|
8
|
+
~~~~~
|
|
9
|
+
|
|
10
|
+
list available serial ports
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import argparse
|
|
14
|
+
import sys
|
|
15
|
+
|
|
16
|
+
from lscom.__version__ import __title__, __version__
|
|
17
|
+
from lscom.app import run
|
|
18
|
+
|
|
19
|
+
PY_MAJOR = 3
|
|
20
|
+
PY_MINOR = 2
|
|
21
|
+
MINIMUM_PYTHON_VERISON = "3.2"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def check_python_version(): # type: ignore
|
|
25
|
+
"""Use old-school .format() method for if someone uses with very old Python."""
|
|
26
|
+
msg = """
|
|
27
|
+
|
|
28
|
+
{title} version {pkgv} requires Python version {pyv} or higher.
|
|
29
|
+
""".format(
|
|
30
|
+
title=__title__, pkgv=__version__, pyv=MINIMUM_PYTHON_VERISON
|
|
31
|
+
)
|
|
32
|
+
if sys.version_info < (PY_MAJOR, PY_MINOR):
|
|
33
|
+
raise ValueError(msg)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def main():
|
|
37
|
+
parser = argparse.ArgumentParser(
|
|
38
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
39
|
+
description="lscom: list and discover available COM ports",
|
|
40
|
+
epilog="Made with Python by Josh Schmelzle",
|
|
41
|
+
)
|
|
42
|
+
parser.add_argument(
|
|
43
|
+
"--version", "-v", action="version", version=f"lscom version {__version__}"
|
|
44
|
+
)
|
|
45
|
+
args = parser.parse_args() # noqa: F841
|
|
46
|
+
run()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def init():
|
|
50
|
+
check_python_version() # type: ignore
|
|
51
|
+
|
|
52
|
+
if __name__ == "__main__":
|
|
53
|
+
sys.exit(main())
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
init()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
# | _ _ _ ._ _
|
|
4
|
-
# | _> (_ (_) | | |
|
|
5
|
-
|
|
6
|
-
"""version information for lscom"""
|
|
7
|
-
|
|
8
|
-
__title__ = "lscom"
|
|
9
|
-
__description__ = "list available active COM ports"
|
|
10
|
-
__url__ = "https://github.com/joshschmelzle/lscom"
|
|
11
|
-
__version__ = "0.0.
|
|
12
|
-
__author__ = "Josh Schmelzle"
|
|
13
|
-
__author_email__ = "josh@joshschmelzle.com"
|
|
14
|
-
__license__ = "MIT"
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# | _ _ _ ._ _
|
|
4
|
+
# | _> (_ (_) | | |
|
|
5
|
+
|
|
6
|
+
"""version information for lscom"""
|
|
7
|
+
|
|
8
|
+
__title__ = "lscom"
|
|
9
|
+
__description__ = "list available active COM ports"
|
|
10
|
+
__url__ = "https://github.com/joshschmelzle/lscom"
|
|
11
|
+
__version__ = "0.0.5"
|
|
12
|
+
__author__ = "Josh Schmelzle"
|
|
13
|
+
__author_email__ = "josh@joshschmelzle.com"
|
|
14
|
+
__license__ = "MIT"
|
|
@@ -1,110 +1,111 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
# | _ _ _ ._ _
|
|
4
|
-
# | _> (_ (_) | | |
|
|
5
|
-
|
|
6
|
-
"""
|
|
7
|
-
lscom.app
|
|
8
|
-
~~~~~~~~~
|
|
9
|
-
|
|
10
|
-
main app code
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
import glob
|
|
14
|
-
import os
|
|
15
|
-
import sys
|
|
16
|
-
|
|
17
|
-
try:
|
|
18
|
-
import serial # type: ignore
|
|
19
|
-
except ModuleNotFoundError:
|
|
20
|
-
print("required module pyserial not found... exiting...")
|
|
21
|
-
sys.exit(-1)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class lscom:
|
|
25
|
-
"""Main application class."""
|
|
26
|
-
|
|
27
|
-
def check_serial_permissions(self):
|
|
28
|
-
"""
|
|
29
|
-
Check if current user has permissions for serial port access on Linux.
|
|
30
|
-
|
|
31
|
-
Add to dialout:
|
|
32
|
-
sudo usermod -a -G dialout $USER
|
|
33
|
-
|
|
34
|
-
Remove from dialout:
|
|
35
|
-
sudo gpasswd -d $USER dialout
|
|
36
|
-
|
|
37
|
-
:returns:
|
|
38
|
-
Tuple: (bool, message)
|
|
39
|
-
"""
|
|
40
|
-
if not sys.platform.startswith("linux"):
|
|
41
|
-
return True, "Permission check required"
|
|
42
|
-
|
|
43
|
-
try:
|
|
44
|
-
import grp
|
|
45
|
-
|
|
46
|
-
dialout = grp.getgrnam("dialout")
|
|
47
|
-
groups = os.getgroups()
|
|
48
|
-
user = os.getlogin()
|
|
49
|
-
if dialout.gr_gid in groups:
|
|
50
|
-
return True, f"{user} has dialout group access"
|
|
51
|
-
else:
|
|
52
|
-
return (
|
|
53
|
-
False,
|
|
54
|
-
f"""
|
|
55
|
-
{user} is not in the dialout group. To fix:
|
|
56
|
-
1. Run: sudo usermod -a -G dialout {user}
|
|
57
|
-
2.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
_serial.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# | _ _ _ ._ _
|
|
4
|
+
# | _> (_ (_) | | |
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
lscom.app
|
|
8
|
+
~~~~~~~~~
|
|
9
|
+
|
|
10
|
+
main app code
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import glob
|
|
14
|
+
import os
|
|
15
|
+
import sys
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
import serial # type: ignore
|
|
19
|
+
except ModuleNotFoundError:
|
|
20
|
+
print("required module pyserial not found... exiting...")
|
|
21
|
+
sys.exit(-1)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class lscom:
|
|
25
|
+
"""Main application class."""
|
|
26
|
+
|
|
27
|
+
def check_serial_permissions(self):
|
|
28
|
+
"""
|
|
29
|
+
Check if current user has permissions for serial port access on Linux.
|
|
30
|
+
|
|
31
|
+
Add to dialout:
|
|
32
|
+
sudo usermod -a -G dialout $USER
|
|
33
|
+
|
|
34
|
+
Remove from dialout:
|
|
35
|
+
sudo gpasswd -d $USER dialout
|
|
36
|
+
|
|
37
|
+
:returns:
|
|
38
|
+
Tuple: (bool, message)
|
|
39
|
+
"""
|
|
40
|
+
if not sys.platform.startswith("linux"):
|
|
41
|
+
return True, "Permission check required"
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
import grp
|
|
45
|
+
|
|
46
|
+
dialout = grp.getgrnam("dialout")
|
|
47
|
+
groups = os.getgroups()
|
|
48
|
+
user = os.getlogin()
|
|
49
|
+
if dialout.gr_gid in groups:
|
|
50
|
+
return True, f"{user} has dialout group access"
|
|
51
|
+
else:
|
|
52
|
+
return (
|
|
53
|
+
False,
|
|
54
|
+
f"""
|
|
55
|
+
{user} is not in the dialout group. To fix:
|
|
56
|
+
1. Run: sudo usermod -a -G dialout {user}
|
|
57
|
+
2. Run: newgrp dialout (to apply changes immediately)
|
|
58
|
+
Or log out and back in for the changes to take effect
|
|
59
|
+
""",
|
|
60
|
+
)
|
|
61
|
+
except KeyError:
|
|
62
|
+
return False, "dialout group not found"
|
|
63
|
+
except Exception as error:
|
|
64
|
+
return False, f"Error checking permissions: {str(error)}"
|
|
65
|
+
|
|
66
|
+
def get_active_serial_port_names(self):
|
|
67
|
+
"""Lists serial port names
|
|
68
|
+
|
|
69
|
+
:raises EnvironmentError:
|
|
70
|
+
On unsupported or unknown platforms
|
|
71
|
+
:returns:
|
|
72
|
+
A list of the serial ports available on the system
|
|
73
|
+
"""
|
|
74
|
+
has_permissions, message = self.check_serial_permissions()
|
|
75
|
+
if not has_permissions:
|
|
76
|
+
print(message)
|
|
77
|
+
if sys.platform.startswith("win"):
|
|
78
|
+
ports = ["COM%s" % (i + 1) for i in range(256)]
|
|
79
|
+
elif sys.platform.startswith("linux") or sys.platform.startswith("cygwin"):
|
|
80
|
+
# this excludes your current terminal "/dev/tty"
|
|
81
|
+
ports = glob.glob("/dev/tty[A-Za-z]*")
|
|
82
|
+
elif sys.platform.startswith("darwin"):
|
|
83
|
+
ports = glob.glob("/dev/tty.*")
|
|
84
|
+
else:
|
|
85
|
+
raise EnvironmentError(
|
|
86
|
+
"appears to be an unsupported platform", sys.platform
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
result = []
|
|
90
|
+
for port in ports:
|
|
91
|
+
try:
|
|
92
|
+
_serial = serial.Serial(port)
|
|
93
|
+
_serial.close()
|
|
94
|
+
result.append(port)
|
|
95
|
+
except (OSError, serial.SerialException):
|
|
96
|
+
pass
|
|
97
|
+
return result
|
|
98
|
+
|
|
99
|
+
def run(self):
|
|
100
|
+
serials = self.get_active_serial_port_names()
|
|
101
|
+
if len(serials) > 0:
|
|
102
|
+
print("{0} serial ports detected and available:".format(len(serials)))
|
|
103
|
+
for _ in serials:
|
|
104
|
+
print(_)
|
|
105
|
+
else:
|
|
106
|
+
print("no available serial ports detected")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def run() -> None:
|
|
110
|
+
"""Run the application."""
|
|
111
|
+
lscom().run()
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: lscom
|
|
3
|
-
Version: 0.0.
|
|
4
|
-
Summary: list available active COM ports
|
|
5
|
-
Home-page: https://github.com/joshschmelzle/lscom
|
|
6
|
-
Author: Josh Schmelzle
|
|
7
|
-
Author-email: josh@joshschmelzle.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Keywords: com,com ports,serial
|
|
10
|
-
Classifier: Natural Language :: English
|
|
11
|
-
Classifier: Development Status :: 3 - Alpha
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.2
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: Intended Audience :: System Administrators
|
|
15
|
-
Classifier: Topic :: Utilities
|
|
16
|
-
Requires-Python: >3.2,
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
License-File: LICENSE
|
|
19
|
-
Requires-Dist: pyserial
|
|
20
|
-
Dynamic: author
|
|
21
|
-
Dynamic: author-email
|
|
22
|
-
Dynamic: classifier
|
|
23
|
-
Dynamic: description
|
|
24
|
-
Dynamic: description-content-type
|
|
25
|
-
Dynamic: home-page
|
|
26
|
-
Dynamic: keywords
|
|
27
|
-
Dynamic: license
|
|
28
|
-
Dynamic: license-file
|
|
29
|
-
Dynamic: requires-dist
|
|
30
|
-
Dynamic: requires-python
|
|
31
|
-
Dynamic: summary
|
|
32
|
-
|
|
33
|
-
    [](https://github.com/joshschmelzle/lscom/blob/main/CODE_OF_CONDUCT.md)
|
|
34
|
-
|
|
35
|
-
# lscom: list and discover available COM ports
|
|
36
|
-
|
|
37
|
-
More quickly identify which COM ports are available for use. Any COM ports already in use will not be listed. `lscom` should work cross platform (Linux, macOS, Windows), but has not been extensively tested. Have a problem? Open an issue.
|
|
38
|
-
|
|
39
|
-
## Usage Example
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
$ lscom
|
|
43
|
-
['COM3']
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Installation from PyPI
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
python -m pip install lscom
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Local Installation Example
|
|
53
|
-
|
|
54
|
-
To install manually:
|
|
55
|
-
|
|
56
|
-
1. Clone repository.
|
|
57
|
-
|
|
58
|
-
2. Open the terminal to the root of the repository.
|
|
59
|
-
|
|
60
|
-
3. Run-
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
python -m pip install .
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
You should now be able to run `lscom` from your terminal
|
|
67
|
-
|
|
68
|
-
If you can't, check and make sure the scripts directory is included in the system path environment variable.
|
|
69
|
-
|
|
70
|
-
To remove:
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
python -m pip uninstall lscom
|
|
74
|
-
```
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lscom
|
|
3
|
+
Version: 0.0.5
|
|
4
|
+
Summary: list available active COM ports
|
|
5
|
+
Home-page: https://github.com/joshschmelzle/lscom
|
|
6
|
+
Author: Josh Schmelzle
|
|
7
|
+
Author-email: josh@joshschmelzle.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: com,com ports,serial
|
|
10
|
+
Classifier: Natural Language :: English
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.2
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: Topic :: Utilities
|
|
16
|
+
Requires-Python: >3.2,
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: pyserial
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: author-email
|
|
22
|
+
Dynamic: classifier
|
|
23
|
+
Dynamic: description
|
|
24
|
+
Dynamic: description-content-type
|
|
25
|
+
Dynamic: home-page
|
|
26
|
+
Dynamic: keywords
|
|
27
|
+
Dynamic: license
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
Dynamic: requires-dist
|
|
30
|
+
Dynamic: requires-python
|
|
31
|
+
Dynamic: summary
|
|
32
|
+
|
|
33
|
+
    [](https://github.com/joshschmelzle/lscom/blob/main/CODE_OF_CONDUCT.md)
|
|
34
|
+
|
|
35
|
+
# lscom: list and discover available COM ports
|
|
36
|
+
|
|
37
|
+
More quickly identify which COM ports are available for use. Any COM ports already in use will not be listed. `lscom` should work cross platform (Linux, macOS, Windows), but has not been extensively tested. Have a problem? Open an issue.
|
|
38
|
+
|
|
39
|
+
## Usage Example
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
$ lscom
|
|
43
|
+
['COM3']
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Installation from PyPI
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python -m pip install lscom
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Local Installation Example
|
|
53
|
+
|
|
54
|
+
To install manually:
|
|
55
|
+
|
|
56
|
+
1. Clone repository.
|
|
57
|
+
|
|
58
|
+
2. Open the terminal to the root of the repository.
|
|
59
|
+
|
|
60
|
+
3. Run-
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
python -m pip install .
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
You should now be able to run `lscom` from your terminal
|
|
67
|
+
|
|
68
|
+
If you can't, check and make sure the scripts directory is included in the system path environment variable.
|
|
69
|
+
|
|
70
|
+
To remove:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python -m pip uninstall lscom
|
|
74
|
+
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[egg_info]
|
|
2
|
-
tag_build =
|
|
3
|
-
tag_date = 0
|
|
4
|
-
|
|
1
|
+
[egg_info]
|
|
2
|
+
tag_build =
|
|
3
|
+
tag_date = 0
|
|
4
|
+
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
import os
|
|
4
|
-
import sys
|
|
5
|
-
|
|
6
|
-
from setuptools import find_packages, setup
|
|
7
|
-
|
|
8
|
-
here = os.path.abspath(os.path.dirname(__file__))
|
|
9
|
-
|
|
10
|
-
# 'python setup.py build' shortcut
|
|
11
|
-
if sys.argv[-1] == "build":
|
|
12
|
-
os.system("python setup.py sdist bdist_wheel")
|
|
13
|
-
sys.exit()
|
|
14
|
-
|
|
15
|
-
# 'python setup.py check' shortcut
|
|
16
|
-
if sys.argv[-1] == "check":
|
|
17
|
-
os.system("python -m twine check dist/*")
|
|
18
|
-
sys.exit()
|
|
19
|
-
|
|
20
|
-
# 'python setup.py deploy' shortcut
|
|
21
|
-
if sys.argv[-1] == "deploy":
|
|
22
|
-
os.system("python -m twine upload dist/*")
|
|
23
|
-
sys.exit()
|
|
24
|
-
|
|
25
|
-
# load the package's __version__.py module as a dictionary
|
|
26
|
-
about = {}
|
|
27
|
-
with open(os.path.join(here, "lscom", "__version__.py")) as f:
|
|
28
|
-
exec(f.read(), about)
|
|
29
|
-
|
|
30
|
-
try:
|
|
31
|
-
with open("README.md", "r") as f:
|
|
32
|
-
readme = f.read()
|
|
33
|
-
except FileNotFoundError:
|
|
34
|
-
long_description = about["__description__"]
|
|
35
|
-
|
|
36
|
-
requires = ["pyserial"]
|
|
37
|
-
|
|
38
|
-
setup(
|
|
39
|
-
name=about["__title__"],
|
|
40
|
-
version=about["__version__"],
|
|
41
|
-
description=about["__description__"],
|
|
42
|
-
long_description=readme,
|
|
43
|
-
long_description_content_type="text/markdown",
|
|
44
|
-
author=about["__author__"],
|
|
45
|
-
author_email=about["__author_email__"],
|
|
46
|
-
url=about["__url__"],
|
|
47
|
-
keywords=["com", "com ports", "serial"],
|
|
48
|
-
python_requires=">3.2,",
|
|
49
|
-
license=about["__license__"],
|
|
50
|
-
classifiers=[
|
|
51
|
-
"Natural Language :: English",
|
|
52
|
-
"Development Status :: 3 - Alpha",
|
|
53
|
-
"Programming Language :: Python :: 3.2",
|
|
54
|
-
"Intended Audience :: Developers",
|
|
55
|
-
"Intended Audience :: System Administrators",
|
|
56
|
-
"Topic :: Utilities",
|
|
57
|
-
],
|
|
58
|
-
packages=find_packages(
|
|
59
|
-
exclude=(
|
|
60
|
-
"tests",
|
|
61
|
-
"test",
|
|
62
|
-
)
|
|
63
|
-
),
|
|
64
|
-
install_requires=requires,
|
|
65
|
-
entry_points={"console_scripts": ["lscom=lscom.__main__:main"]},
|
|
66
|
-
)
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from setuptools import find_packages, setup
|
|
7
|
+
|
|
8
|
+
here = os.path.abspath(os.path.dirname(__file__))
|
|
9
|
+
|
|
10
|
+
# 'python setup.py build' shortcut
|
|
11
|
+
if sys.argv[-1] == "build":
|
|
12
|
+
os.system("python setup.py sdist bdist_wheel")
|
|
13
|
+
sys.exit()
|
|
14
|
+
|
|
15
|
+
# 'python setup.py check' shortcut
|
|
16
|
+
if sys.argv[-1] == "check":
|
|
17
|
+
os.system("python -m twine check dist/*")
|
|
18
|
+
sys.exit()
|
|
19
|
+
|
|
20
|
+
# 'python setup.py deploy' shortcut
|
|
21
|
+
if sys.argv[-1] == "deploy":
|
|
22
|
+
os.system("python -m twine upload dist/*")
|
|
23
|
+
sys.exit()
|
|
24
|
+
|
|
25
|
+
# load the package's __version__.py module as a dictionary
|
|
26
|
+
about = {}
|
|
27
|
+
with open(os.path.join(here, "lscom", "__version__.py")) as f:
|
|
28
|
+
exec(f.read(), about)
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
with open("README.md", "r") as f:
|
|
32
|
+
readme = f.read()
|
|
33
|
+
except FileNotFoundError:
|
|
34
|
+
long_description = about["__description__"]
|
|
35
|
+
|
|
36
|
+
requires = ["pyserial"]
|
|
37
|
+
|
|
38
|
+
setup(
|
|
39
|
+
name=about["__title__"],
|
|
40
|
+
version=about["__version__"],
|
|
41
|
+
description=about["__description__"],
|
|
42
|
+
long_description=readme,
|
|
43
|
+
long_description_content_type="text/markdown",
|
|
44
|
+
author=about["__author__"],
|
|
45
|
+
author_email=about["__author_email__"],
|
|
46
|
+
url=about["__url__"],
|
|
47
|
+
keywords=["com", "com ports", "serial"],
|
|
48
|
+
python_requires=">3.2,",
|
|
49
|
+
license=about["__license__"],
|
|
50
|
+
classifiers=[
|
|
51
|
+
"Natural Language :: English",
|
|
52
|
+
"Development Status :: 3 - Alpha",
|
|
53
|
+
"Programming Language :: Python :: 3.2",
|
|
54
|
+
"Intended Audience :: Developers",
|
|
55
|
+
"Intended Audience :: System Administrators",
|
|
56
|
+
"Topic :: Utilities",
|
|
57
|
+
],
|
|
58
|
+
packages=find_packages(
|
|
59
|
+
exclude=(
|
|
60
|
+
"tests",
|
|
61
|
+
"test",
|
|
62
|
+
)
|
|
63
|
+
),
|
|
64
|
+
install_requires=requires,
|
|
65
|
+
entry_points={"console_scripts": ["lscom=lscom.__main__:main"]},
|
|
66
|
+
)
|
lscom-0.0.4/pyproject.toml
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|