atomicshop 2.11.22__py3-none-any.whl → 2.11.24__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.22'
4
+ __version__ = '2.11.24'
@@ -134,7 +134,7 @@ def install_docker_ubuntu(
134
134
 
135
135
  if rootless:
136
136
  # Install uidmap package.
137
- if not ubuntu_terminal.is_executable_exists('uidmap'):
137
+ if not ubuntu_terminal.is_package_installed('uidmap'):
138
138
  print_api('uidmap is not installed, installing...', color='yellow')
139
139
  ubuntu_terminal.update_system_packages()
140
140
  ubuntu_terminal.install_packages(['uidmap'])
@@ -156,13 +156,10 @@ def install_docker_ubuntu(
156
156
  process.execute_script(docker_start_command, shell=True, executable=None)
157
157
  process.execute_script(docker_enable_command, shell=True, executable=None)
158
158
 
159
- input("Press Enter to continue...")
160
-
161
159
  with permissions.temporary_regular_permissions():
162
160
  current_non_sudo_user = os.getlogin()
163
161
  # Enable lingering so Docker runs when the user is not logged in
164
162
  process.execute_script(f'sudo loginctl enable-linger {current_non_sudo_user}', shell=True)
165
- input("Press Enter to continue...")
166
163
 
167
164
  # Add $HOME/bin to your PATH if it's not already there.
168
165
  with permissions.temporary_regular_permissions():
@@ -21,6 +21,27 @@ def install_packages(package_list: list[str]):
21
21
  subprocess.check_call(command)
22
22
 
23
23
 
24
+ def is_package_installed(package: str) -> bool:
25
+ """
26
+ Function checks if a package is installed.
27
+ :param package: str, package name.
28
+ :return:
29
+ """
30
+
31
+ try:
32
+ # Run the dpkg-query command to check if the package is installed
33
+ result = subprocess.run(
34
+ ['apt', '-qq', 'list', '--installed', package], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
35
+ # If the return code is 0 and the output contains 'install ok installed', the package is installed
36
+ if result.returncode == 0 and result.stdout != b'':
37
+ return True
38
+ else:
39
+ return False
40
+ except Exception as e:
41
+ print(f"An error occurred: {e}")
42
+ return False
43
+
44
+
24
45
  def is_package_in_apt_cache(package: str) -> bool:
25
46
  try:
26
47
  # Run the apt-cache show command to check if the package exists
@@ -228,11 +249,15 @@ def add_path_to_bashrc(as_regular_user: bool = False):
228
249
  print("$HOME/bin already in .bashrc")
229
250
 
230
251
 
231
- def get_command_execution_as_sudo_executer(command: str) -> str:
252
+ def get_command_execution_as_sudo_executer(command: str, add_bash_exec: bool = False) -> str:
232
253
  """
233
254
  Function gets the command execution as the sudo executer.
234
255
  The input command should be without 'sudo', if it will be, it will be omitted.
235
256
  :param command: str, the command to execute.
257
+ :param add_bash_exec: bool, if True, the command will be executed with bash.
258
+ Example command: 'systemctl --user start docker.service'
259
+ Example command with add_bash_exec: 'su <sudo_executioner_user> -c "/bin/bash systemctl --user start docker.service"'
260
+ Example command without add_bash_exec: 'su <sudo_executioner_user> -c "systemctl --user start docker.service"'
236
261
  :return: str, the command execution as the sudo executer.
237
262
  """
238
263
 
@@ -245,6 +270,8 @@ def get_command_execution_as_sudo_executer(command: str) -> str:
245
270
  sudo_executer_username: str = permissions.get_ubuntu_sudo_executer_username()
246
271
 
247
272
  if sudo_executer_username:
248
- return f'su {sudo_executer_username} -c "/bin/bash {command}"'
273
+ if add_bash_exec:
274
+ command = f'/bin/bash {command}'
275
+ return f'su {sudo_executer_username} -c "{command}"'
249
276
  else:
250
277
  return command
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.11.22
3
+ Version: 2.11.24
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=J9VEZPOpY7bpVVAApDulvQp5NP0oPKwgRo2d7A0Py4w,124
1
+ atomicshop/__init__.py,sha256=TeyboltWSXVQwI5Y9hPKYn-fVAXGLL5vSg9HS_q7rUI,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
@@ -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=7CKKO700dM6GR2S_6j9lnYWlk94JudzjloAJkFTsw9U,8324
154
+ atomicshop/wrappers/ubuntu_terminal.py,sha256=Kodf7FLBplqfLR86YaXb-JlkRVORPgLVS5P6aHkx-Vg,9541
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=zq94ojAFrrmPX_B1eczxGTMST2x9y6J6Ry9yxHaTmcE,8565
167
+ atomicshop/wrappers/dockerw/install_docker.py,sha256=a9X8GjRiuTRsZbUM3u2UQ2_8pZ0sdsPZSyCOD8SDidg,8473
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.22.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
246
- atomicshop-2.11.22.dist-info/METADATA,sha256=3-5riYcQBh8JJ66yZWuB3Zb0PepN5aGqmJjLjRkV8q4,10448
247
- atomicshop-2.11.22.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
248
- atomicshop-2.11.22.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
249
- atomicshop-2.11.22.dist-info/RECORD,,
245
+ atomicshop-2.11.24.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
246
+ atomicshop-2.11.24.dist-info/METADATA,sha256=WNIdPwnfzXdLe2RNmXO2foCbvizbcBYiqNJcCJUQiFU,10448
247
+ atomicshop-2.11.24.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
248
+ atomicshop-2.11.24.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
249
+ atomicshop-2.11.24.dist-info/RECORD,,