atomicshop 2.11.16__py3-none-any.whl → 2.11.18__py3-none-any.whl

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.

Potentially problematic release.


This version of atomicshop might be problematic. Click here for more details.

atomicshop/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  """Atomic Basic functions and classes to make developer life easier"""
2
2
 
3
3
  __author__ = "Den Kras"
4
- __version__ = '2.11.16'
4
+ __version__ = '2.11.18'
atomicshop/permissions.py CHANGED
@@ -1,5 +1,5 @@
1
1
  import os
2
- import sys
2
+ import pwd
3
3
  import stat
4
4
  import ctypes
5
5
  import contextlib
@@ -102,3 +102,9 @@ def temporary_regular_permissions():
102
102
  # Revert to the original effective user and group ID
103
103
  os.seteuid(original_euid)
104
104
  os.setegid(original_egid)
105
+
106
+
107
+ def expand_user_path(user_name, path):
108
+ pwnam = pwd.getpwnam(user_name)
109
+ home_dir = pwnam.pw_dir
110
+ return path.replace("~", home_dir)
@@ -141,15 +141,20 @@ def install_docker_ubuntu(
141
141
  # After 'get-docker.sh' execution, we will install docker in rootless mode.
142
142
  process.execute_script('dockerd-rootless-setuptool.sh install', shell=True, as_regular_user=True)
143
143
 
144
- # # Start and enable the docker service in user mode.
145
- # ubuntu_terminal.start_enable_service_check_availability('docker.service', user_mode=True, sudo=False)
144
+ # Start and enable the docker service in user mode.
145
+ ubuntu_terminal.start_enable_service_check_availability('docker.service', user_mode=True, sudo=False)
146
+ input("Press Enter to continue...")
146
147
 
148
+ with permissions.temporary_regular_permissions():
149
+ current_non_sudo_user = os.getlogin()
147
150
  # Enable lingering so Docker runs when the user is not logged in
148
- subprocess.run(['sudo', 'loginctl', 'enable-linger', os.getlogin()], shell=True)
151
+ process.execute_script(f'sudo loginctl enable-linger {current_non_sudo_user}', shell=True)
152
+ input("Press Enter to continue...")
149
153
 
150
154
  # Add $HOME/bin to your PATH if it's not already there.
151
155
  with permissions.temporary_regular_permissions():
152
- ubuntu_terminal.add_path_to_bashrc()
156
+ ubuntu_terminal.add_path_to_bashrc(as_regular_user=True)
157
+ input("Press Enter to continue...")
153
158
 
154
159
  if add_current_user_to_docker_group_bool:
155
160
  # Check if current user that executed the script is a sudo user. If not, use the current user.
@@ -5,6 +5,7 @@ import shutil
5
5
  import time
6
6
 
7
7
  from ..print_api import print_api
8
+ from .. import permissions
8
9
 
9
10
 
10
11
  def install_packages(package_list: list[str]):
@@ -201,11 +202,24 @@ def start_enable_service_check_availability(
201
202
  print_api(f"[{service_name}] service is running.", color='green', **(print_kwargs or {}))
202
203
 
203
204
 
204
- def add_path_to_bashrc():
205
- """Add $HOME/bin to the PATH in .bashrc if it's not already present."""
206
- bashrc_path = os.path.expanduser("~/.bashrc")
205
+ def add_path_to_bashrc(as_regular_user: bool = False):
206
+ """Add $HOME/bin to the PATH in .bashrc if it's not already present.
207
+ :param as_regular_user: bool, if True, the function will run as a regular user even if executed with sudo.
208
+ """
209
+ home_path_bashrc = "~/.bashrc"
210
+
211
+ if as_regular_user:
212
+ # Get the current non-sudo user
213
+ with permissions.temporary_regular_permissions():
214
+ current_non_sudo_user = os.getlogin()
215
+
216
+ # Get the home path of the current non-sudo user
217
+ user_bashrc_path = permissions.expand_user_path(current_non_sudo_user, home_path_bashrc)
218
+ else:
219
+ user_bashrc_path = os.path.expanduser(home_path_bashrc)
220
+
207
221
  new_path = 'export PATH=$PATH:$HOME/bin\n'
208
- with open(bashrc_path, 'r+') as bashrc:
222
+ with open(user_bashrc_path, 'r+') as bashrc:
209
223
  content = bashrc.read()
210
224
  if "$HOME/bin" not in content:
211
225
  bashrc.write(new_path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.11.16
3
+ Version: 2.11.18
4
4
  Summary: Atomic functions and classes to make developer life easier
5
5
  Author: Denis Kras
6
6
  License: MIT License
@@ -1,4 +1,4 @@
1
- atomicshop/__init__.py,sha256=eAsq_cjIOGhh6JncibhUbypzp2z_j4OpMwx5qdL_uTY,124
1
+ atomicshop/__init__.py,sha256=s0q29AawhObpnNL8y1mxZfE_uwbVj3XwmaPjU7EHTAE,124
2
2
  atomicshop/_basics_temp.py,sha256=6cu2dd6r2dLrd1BRNcVDKTHlsHs_26Gpw8QS6v32lQ0,3699
3
3
  atomicshop/_create_pdf_demo.py,sha256=Yi-PGZuMg0RKvQmLqVeLIZYadqEZwUm-4A9JxBl_vYA,3713
4
4
  atomicshop/_patch_import.py,sha256=ENp55sKVJ0e6-4lBvZnpz9PQCt3Otbur7F6aXDlyje4,6334
@@ -22,7 +22,7 @@ atomicshop/inspect_wrapper.py,sha256=sGRVQhrJovNygHTydqJj0hxES-aB2Eg9KbIk3G31apw
22
22
  atomicshop/ip_addresses.py,sha256=Hvi4TumEFoTEpKWaq5WNF-YzcRzt24IxmNgv-Mgax1s,1190
23
23
  atomicshop/keyboard_press.py,sha256=1W5kRtOB75fulVx-uF2yarBhW0_IzdI1k73AnvXstk0,452
24
24
  atomicshop/pbtkmultifile_argparse.py,sha256=aEk8nhvoQVu-xyfZosK3ma17CwIgOjzO1erXXdjwtS4,4574
25
- atomicshop/permissions.py,sha256=y63kcxU6GAmnVXqWhs_N29XorOD2xYWlK_CjZ1PpHgA,2897
25
+ atomicshop/permissions.py,sha256=tKIluW-p3ThLh1H3QEFgPFRVzw5hafAHk9QJ5OOT_0M,3047
26
26
  atomicshop/print_api.py,sha256=DhbCQd0MWZZ5GYEk4oTu1opRFC-b31g1VWZgTGewG2Y,11568
27
27
  atomicshop/process.py,sha256=_aDmnQBwpQAD6LO5VPGFFQxkywq5gK7m8N9Z_FHwdDo,15535
28
28
  atomicshop/process_name_cmd.py,sha256=TNAK6kQZm5JKWzEW6QLqVHEG98ZLNDQiSS4YwDk8V8c,3830
@@ -151,7 +151,7 @@ atomicshop/wrappers/olefilew.py,sha256=biD5m58rogifCYmYhJBrAFb9O_Bn_spLek_9HofLe
151
151
  atomicshop/wrappers/pipw.py,sha256=iq4pDhmrHqKbcRi3Y6_v2PQSdb4fqfAx79rsX7JEmXo,801
152
152
  atomicshop/wrappers/process_wrapper_pbtk.py,sha256=ycPmBRnv627RWks6N8OhxJQe8Gu3h3Vwj-4HswPOw0k,599
153
153
  atomicshop/wrappers/pyopensslw.py,sha256=OBWxA6EJ2vU_Qlf4M8m6ilcG3hyYB4yB0EsXUf7NhEU,6804
154
- atomicshop/wrappers/ubuntu_terminal.py,sha256=JkWSZOJ1P4af5UPZIAHYxp81KXMis3CDyjKI9RBY1aI,6954
154
+ atomicshop/wrappers/ubuntu_terminal.py,sha256=zKSp5d8aBLHQwFg2P9zYVEM1g5_zp3ctFUs3O9Vh5Bc,7533
155
155
  atomicshop/wrappers/wslw.py,sha256=AKphiHLSddL7ErevUowr3f9Y1AgGz_R3KZ3NssW07h8,6959
156
156
  atomicshop/wrappers/certauthw/certauth.py,sha256=hKedW0DOWlEigSNm8wu4SqHkCQsGJ1tJfH7s4nr3Bk0,12223
157
157
  atomicshop/wrappers/certauthw/certauthw.py,sha256=4WvhjANI7Kzqrr_nKmtA8Kf7B6rute_5wfP65gwQrjw,8082
@@ -164,7 +164,7 @@ atomicshop/wrappers/ctyping/msi_windows_installer/extract_msi_main.py,sha256=eyF
164
164
  atomicshop/wrappers/ctyping/msi_windows_installer/tables.py,sha256=ajiFiLXl1prg2kOhatfT8E2RKX7F8JjUJpwkVuKu1GY,16263
165
165
  atomicshop/wrappers/dockerw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
166
166
  atomicshop/wrappers/dockerw/dockerw.py,sha256=w8zSJr5C7cbvbuG09ORCpAe0BOcibqqL_Z2EKEBHYK4,6266
167
- atomicshop/wrappers/dockerw/install_docker.py,sha256=SFA2LYVE0uwILGe8SeIRm-3taqEXCWwQNZVNyn-T4UU,7589
167
+ atomicshop/wrappers/dockerw/install_docker.py,sha256=DckJztRHgRKXV5UjfoU5FH2AXxLf8B8z76am5Mb_u9M,7860
168
168
  atomicshop/wrappers/elasticsearchw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
169
169
  atomicshop/wrappers/elasticsearchw/config_basic.py,sha256=fDujtrjEjbWiYh_WQ3OcYp_8mXhXPYeKLy4wSPL5qM0,1177
170
170
  atomicshop/wrappers/elasticsearchw/elasticsearchw.py,sha256=7TqFdEFznO8NlligJhEKk1vm641ALpCYdaRl1uoXdzM,9768
@@ -242,8 +242,8 @@ atomicshop/wrappers/socketw/socket_server_tester.py,sha256=AhpurHJmP2kgzHaUbq5ey
242
242
  atomicshop/wrappers/socketw/socket_wrapper.py,sha256=aXBwlEIJhFT0-c4i8iNlFx2It9VpCEpsv--5Oqcpxao,11624
243
243
  atomicshop/wrappers/socketw/ssl_base.py,sha256=k4V3gwkbq10MvOH4btU4onLX2GNOsSfUAdcHmL1rpVE,2274
244
244
  atomicshop/wrappers/socketw/statistics_csv.py,sha256=t3dtDEfN47CfYVi0CW6Kc2QHTEeZVyYhc57IYYh5nmA,826
245
- atomicshop-2.11.16.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
246
- atomicshop-2.11.16.dist-info/METADATA,sha256=Bq1ANFEtTCbncyJJmsul1ibe66c7CCRby48oV1Qgk_s,10448
247
- atomicshop-2.11.16.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
248
- atomicshop-2.11.16.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
249
- atomicshop-2.11.16.dist-info/RECORD,,
245
+ atomicshop-2.11.18.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
246
+ atomicshop-2.11.18.dist-info/METADATA,sha256=Xiosg33Tz5exTD_ccQRgYX-Dlbu7r_XEUApMrl0eOCY,10448
247
+ atomicshop-2.11.18.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
248
+ atomicshop-2.11.18.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
249
+ atomicshop-2.11.18.dist-info/RECORD,,