lscom 0.0.2__tar.gz → 0.0.4__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/LICENSE ADDED
@@ -0,0 +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.
lscom-0.0.4/PKG-INFO ADDED
@@ -0,0 +1,74 @@
1
+ Metadata-Version: 2.4
2
+ Name: lscom
3
+ Version: 0.0.4
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
+ ![pypi-badge](https://img.shields.io/pypi/v/lscom) ![pypi-format](https://img.shields.io/pypi/format/lscom) ![pypi-implementation](https://img.shields.io/pypi/implementation/lscom) ![pypi-version](https://img.shields.io/pypi/pyversions/lscom) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](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
+ ```
@@ -11,7 +11,7 @@ $ lscom
11
11
  ['COM3']
12
12
  ```
13
13
 
14
- ## PyPI Installation
14
+ ## Installation from PyPI
15
15
 
16
16
  ```bash
17
17
  python -m pip install lscom
@@ -10,9 +10,9 @@ lscom
10
10
  list available serial ports
11
11
  """
12
12
 
13
+ import argparse
13
14
  import sys
14
15
 
15
- from lscom import helpers
16
16
  from lscom.__version__ import __title__, __version__
17
17
  from lscom.app import run
18
18
 
@@ -34,7 +34,14 @@ def check_python_version(): # type: ignore
34
34
 
35
35
 
36
36
  def main():
37
- parser = helpers.setup_parser()
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
+ )
38
45
  args = parser.parse_args() # noqa: F841
39
46
  run()
40
47
 
@@ -43,8 +50,7 @@ def init():
43
50
  check_python_version() # type: ignore
44
51
 
45
52
  if __name__ == "__main__":
46
- main()
47
- sys.exit(0)
53
+ sys.exit(main())
48
54
 
49
55
 
50
56
  init()
@@ -3,12 +3,12 @@
3
3
  # | _ _ _ ._ _
4
4
  # | _> (_ (_) | | |
5
5
 
6
- """ version information for lscom """
6
+ """version information for lscom"""
7
7
 
8
8
  __title__ = "lscom"
9
9
  __description__ = "list available active COM ports"
10
10
  __url__ = "https://github.com/joshschmelzle/lscom"
11
- __version__ = "0.0.2"
11
+ __version__ = "0.0.4"
12
12
  __author__ = "Josh Schmelzle"
13
13
  __author_email__ = "josh@joshschmelzle.com"
14
14
  __license__ = "MIT"
@@ -11,6 +11,7 @@ main app code
11
11
  """
12
12
 
13
13
  import glob
14
+ import os
14
15
  import sys
15
16
 
16
17
  try:
@@ -23,6 +24,44 @@ except ModuleNotFoundError:
23
24
  class lscom:
24
25
  """Main application class."""
25
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. Log out and back in for the changes to take effect
58
+ """,
59
+ )
60
+ except KeyError:
61
+ return False, "dialout group not found"
62
+ except Exception as error:
63
+ return False, f"Error checking permissions: {str(error)}"
64
+
26
65
  def get_active_serial_port_names(self):
27
66
  """Lists serial port names
28
67
 
@@ -31,6 +70,9 @@ class lscom:
31
70
  :returns:
32
71
  A list of the serial ports available on the system
33
72
  """
73
+ has_permissions, message = self.check_serial_permissions()
74
+ if not has_permissions:
75
+ print(message)
34
76
  if sys.platform.startswith("win"):
35
77
  ports = ["COM%s" % (i + 1) for i in range(256)]
36
78
  elif sys.platform.startswith("linux") or sys.platform.startswith("cygwin"):
@@ -0,0 +1,74 @@
1
+ Metadata-Version: 2.4
2
+ Name: lscom
3
+ Version: 0.0.4
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
+ ![pypi-badge](https://img.shields.io/pypi/v/lscom) ![pypi-format](https://img.shields.io/pypi/format/lscom) ![pypi-implementation](https://img.shields.io/pypi/implementation/lscom) ![pypi-version](https://img.shields.io/pypi/pyversions/lscom) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](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,3 +1,4 @@
1
+ LICENSE
1
2
  README.md
2
3
  pyproject.toml
3
4
  setup.py
@@ -5,7 +6,6 @@ lscom/__init__.py
5
6
  lscom/__main__.py
6
7
  lscom/__version__.py
7
8
  lscom/app.py
8
- lscom/helpers.py
9
9
  lscom.egg-info/PKG-INFO
10
10
  lscom.egg-info/SOURCES.txt
11
11
  lscom.egg-info/dependency_links.txt
@@ -1,3 +1,2 @@
1
1
  [console_scripts]
2
2
  lscom = lscom.__main__:main
3
-
@@ -17,6 +17,11 @@ if sys.argv[-1] == "check":
17
17
  os.system("python -m twine check dist/*")
18
18
  sys.exit()
19
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
+
20
25
  # load the package's __version__.py module as a dictionary
21
26
  about = {}
22
27
  with open(os.path.join(here, "lscom", "__version__.py")) as f:
lscom-0.0.2/PKG-INFO DELETED
@@ -1,61 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: lscom
3
- Version: 0.0.2
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
- Description: ![pypi-badge](https://img.shields.io/pypi/v/lscom) ![pypi-format](https://img.shields.io/pypi/format/lscom) ![pypi-implementation](https://img.shields.io/pypi/implementation/lscom) ![pypi-version](https://img.shields.io/pypi/pyversions/lscom) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/joshschmelzle/lscom/blob/main/CODE_OF_CONDUCT.md)
10
-
11
- # lscom: list and discover available COM ports
12
-
13
- 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.
14
-
15
- ## Usage Example
16
-
17
- ```
18
- $ lscom
19
- ['COM3']
20
- ```
21
-
22
- ## PyPI Installation
23
-
24
- ```bash
25
- python -m pip install lscom
26
- ```
27
-
28
- ## Local Installation Example
29
-
30
- To install manually:
31
-
32
- 1. Clone repository.
33
-
34
- 2. Open the terminal to the root of the repository.
35
-
36
- 3. Run-
37
-
38
- ```bash
39
- python -m pip install .
40
- ```
41
-
42
- You should now be able to run `lscom` from your terminal
43
-
44
- If you can't, check and make sure the scripts directory is included in the system path environment variable.
45
-
46
- To remove:
47
-
48
- ```bash
49
- python -m pip uninstall lscom
50
- ```
51
-
52
- Keywords: com,com ports,serial
53
- Platform: UNKNOWN
54
- Classifier: Natural Language :: English
55
- Classifier: Development Status :: 3 - Alpha
56
- Classifier: Programming Language :: Python :: 3.2
57
- Classifier: Intended Audience :: Developers
58
- Classifier: Intended Audience :: System Administrators
59
- Classifier: Topic :: Utilities
60
- Requires-Python: >3.2,
61
- Description-Content-Type: text/markdown
@@ -1,27 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # | _ _ _ ._ _
4
- # | _> (_ (_) | | |
5
-
6
- """
7
- lscom.helpers
8
- ~~~~~~~~~~~~~
9
-
10
- helper functions
11
- """
12
-
13
- import argparse
14
-
15
- from lscom.__version__ import __version__
16
-
17
-
18
- def setup_parser():
19
- """Set default values and handle arg parser."""
20
- parser = argparse.ArgumentParser(
21
- formatter_class=argparse.RawDescriptionHelpFormatter,
22
- description="lscom: list and discover available COM ports",
23
- )
24
- parser.add_argument(
25
- "--version", "-v", action="version", version=f"lscom version is {__version__}"
26
- )
27
- return parser
@@ -1,61 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: lscom
3
- Version: 0.0.2
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
- Description: ![pypi-badge](https://img.shields.io/pypi/v/lscom) ![pypi-format](https://img.shields.io/pypi/format/lscom) ![pypi-implementation](https://img.shields.io/pypi/implementation/lscom) ![pypi-version](https://img.shields.io/pypi/pyversions/lscom) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/joshschmelzle/lscom/blob/main/CODE_OF_CONDUCT.md)
10
-
11
- # lscom: list and discover available COM ports
12
-
13
- 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.
14
-
15
- ## Usage Example
16
-
17
- ```
18
- $ lscom
19
- ['COM3']
20
- ```
21
-
22
- ## PyPI Installation
23
-
24
- ```bash
25
- python -m pip install lscom
26
- ```
27
-
28
- ## Local Installation Example
29
-
30
- To install manually:
31
-
32
- 1. Clone repository.
33
-
34
- 2. Open the terminal to the root of the repository.
35
-
36
- 3. Run-
37
-
38
- ```bash
39
- python -m pip install .
40
- ```
41
-
42
- You should now be able to run `lscom` from your terminal
43
-
44
- If you can't, check and make sure the scripts directory is included in the system path environment variable.
45
-
46
- To remove:
47
-
48
- ```bash
49
- python -m pip uninstall lscom
50
- ```
51
-
52
- Keywords: com,com ports,serial
53
- Platform: UNKNOWN
54
- Classifier: Natural Language :: English
55
- Classifier: Development Status :: 3 - Alpha
56
- Classifier: Programming Language :: Python :: 3.2
57
- Classifier: Intended Audience :: Developers
58
- Classifier: Intended Audience :: System Administrators
59
- Classifier: Topic :: Utilities
60
- Requires-Python: >3.2,
61
- Description-Content-Type: text/markdown
File without changes
File without changes
File without changes
File without changes