atomicshop 2.11.28__py3-none-any.whl → 2.11.30__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.28'
4
+ __version__ = '2.11.30'
@@ -6,6 +6,8 @@ SRC_DIRECTORY_PATH: str = 'src'
6
6
 
7
7
  # Before restart.
8
8
  PRE_INSTALL_FILE_PATH: str = SRC_DIRECTORY_PATH + os.sep + 'install' + os.sep + 'pre_install.sh'
9
+ PRE_INSTALL_PREREQUISITES_FILE_PATH: str = (
10
+ SRC_DIRECTORY_PATH + os.sep + 'install' + os.sep + 'requirements_pre_install.txt')
9
11
 
10
12
  # After restart.
11
13
  INSTALL_LOG_FILE_NAME: str = 'install.log'
@@ -1,12 +1,10 @@
1
1
  import subprocess
2
2
  from pathlib import Path
3
- import sys
4
3
 
5
4
  from .... import permissions, filesystem
6
5
  from ....archiver import zips
7
6
  from ....print_api import print_api
8
- from ... import githubw
9
- from ...dockerw import install_docker
7
+ from ... import githubw, pipw, ubuntu_terminal
10
8
  from .. import config_install
11
9
 
12
10
 
@@ -14,6 +12,7 @@ def install_before_restart(
14
12
  installation_directory: str,
15
13
  remove_existing_installation_directory: bool = True,
16
14
  fact_source_archive_path: str = None,
15
+ use_built_in_fact_installer: bool = True,
17
16
  print_kwargs: dict = None
18
17
  ):
19
18
  """
@@ -29,6 +28,9 @@ def install_before_restart(
29
28
  This is optional, if not provided, the latest version of the FACT_core will be downloaded.
30
29
  The archive should be an exact copy of the FACT_core repository of the master branch as you download it from
31
30
  GitHub.
31
+ :param use_built_in_fact_installer: bool, if True, the built-in FACT_core installer will be used.
32
+ If False, only the regular prerequisites will be installed, while the user will need to install DOCKER
33
+ and Node.js separately.
32
34
  :param print_kwargs: dict, the print kwargs for the print_api function.
33
35
  :return:
34
36
  """
@@ -43,41 +45,52 @@ def install_before_restart(
43
45
  # use_docker_installer=True, rootless=True, add_current_user_to_docker_group_bool=False)
44
46
 
45
47
  # docker_keyring_file_path: str = "/etc/apt/keyrings/docker.gpg"
46
- nodesource_keyring_file_path: str = "/etc/apt/keyrings/nodesource.gpg"
48
+ # nodesource_keyring_file_path: str = "/etc/apt/keyrings/nodesource.gpg"
47
49
  fact_core_pre_install_file_path = str(Path(installation_directory, config_install.PRE_INSTALL_FILE_PATH))
48
50
 
49
51
  # Remove the existing keyrings, so we will not be asked to overwrite it if it exists.
50
52
  # filesystem.remove_file(docker_keyring_file_path)
51
- filesystem.remove_file(nodesource_keyring_file_path)
53
+ # filesystem.remove_file(nodesource_keyring_file_path)
52
54
 
53
55
  # Remove the existing installation directory.
54
56
  if remove_existing_installation_directory:
55
57
  filesystem.remove_directory(installation_directory)
56
58
 
57
59
  # Since you run the script with sudo, we need to change the permissions to the current user.
58
- with permissions.temporary_regular_permissions():
59
- # Create the FACT_core directory.
60
- filesystem.create_directory(installation_directory)
60
+ # with permissions.temporary_regular_permissions():
61
+ # Create the FACT_core directory.
62
+ filesystem.create_directory(installation_directory)
63
+
64
+ if not fact_source_archive_path:
65
+ # Download the FACT_core repo.
66
+ if not filesystem.get_file_paths_from_directory(installation_directory):
67
+ git_wrapper = githubw.GitHubWrapper(repo_url=config_install.FACT_CORE_GITHUB_URL)
68
+ git_wrapper.build_links_from_repo_url()
69
+ git_wrapper.download_and_extract_branch(
70
+ target_directory=installation_directory,
71
+ archive_remove_first_directory=True)
72
+ else:
73
+ # Extract the archive and remove the first directory.
74
+ zips.extract_archive_with_zipfile(
75
+ archive_path=fact_source_archive_path, extract_directory=installation_directory,
76
+ remove_first_directory=True, **(print_kwargs or {}))
61
77
 
62
- if not fact_source_archive_path:
63
- # Download the FACT_core repo.
64
- if not filesystem.get_file_paths_from_directory(installation_directory):
65
- git_wrapper = githubw.GitHubWrapper(repo_url=config_install.FACT_CORE_GITHUB_URL)
66
- git_wrapper.build_links_from_repo_url()
67
- git_wrapper.download_and_extract_branch(
68
- target_directory=installation_directory,
69
- archive_remove_first_directory=True)
70
- else:
71
- # Extract the archive and remove the first directory.
72
- zips.extract_archive_with_zipfile(
73
- archive_path=fact_source_archive_path, extract_directory=installation_directory,
74
- remove_first_directory=True, **(print_kwargs or {}))
78
+ # Set the executable permission on the pre-installation file.
79
+ permissions.set_executable_permission(fact_core_pre_install_file_path)
75
80
 
76
- # Set the executable permission on the pre-installation file.
77
- permissions.set_executable_permission(fact_core_pre_install_file_path)
81
+ if use_built_in_fact_installer:
82
+ # Run the shell script
83
+ subprocess.run(['bash', fact_core_pre_install_file_path])
84
+ else:
85
+ message = ("You will need to install DOCKER and NODEJS separately.\n"
86
+ "This was done to enable Rootless docker install and install other version of NodeJS.")
87
+ print_api(message, color='yellow')
78
88
 
79
- # Run the shell script
80
- subprocess.run(['bash', fact_core_pre_install_file_path])
89
+ ubuntu_terminal.update_system_packages()
90
+ ubuntu_terminal.install_packages(['python3-pip', 'git', 'libffi-dev', 'lsb-release'])
91
+ pipw.install_packages_with_current_interpreter(
92
+ prefer_binary=True,
93
+ requirements_file_path=config_install.PRE_INSTALL_PREREQUISITES_FILE_PATH)
81
94
 
82
95
  # Install docker. FACT installs the docker, but there can be a problem with permissions, so we need to add
83
96
  # the user permissions to the docker group before restart.
@@ -3,15 +3,19 @@ import sys
3
3
 
4
4
 
5
5
  def install_packages_with_current_interpreter(
6
- package_name_list: list[str],
6
+ package_name_list: list[str] = None,
7
7
  user: bool = False,
8
- upgrade: bool = False
8
+ upgrade: bool = False,
9
+ prefer_binary: bool = False,
10
+ requirements_file_path: str = None
9
11
  ):
10
12
  """
11
13
  This function will install the packages with the current interpreter.
12
14
  :param package_name_list: list, the list of package names to install.
13
15
  :param user: bool, if True, the packages will be installed for the current user.
14
16
  :param upgrade: bool, if True, the packages will be upgraded.
17
+ :param prefer_binary: bool, if True, the binary packages will be preferred.
18
+ :param requirements_file_path: string, the path to the requirements file.
15
19
  :return:
16
20
  """
17
21
 
@@ -21,6 +25,14 @@ def install_packages_with_current_interpreter(
21
25
  commands.append("--user")
22
26
  if upgrade:
23
27
  commands.append("--upgrade")
28
+ if prefer_binary:
29
+ commands.append("--prefer-binary")
30
+ if requirements_file_path:
31
+ commands.append("-r")
32
+ commands.append(requirements_file_path)
24
33
 
25
- for package_name in package_name_list:
26
- subprocess.check_call([*commands, package_name])
34
+ if package_name_list:
35
+ for package_name in package_name_list:
36
+ subprocess.check_call([*commands, package_name])
37
+ else:
38
+ subprocess.check_call(commands)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.11.28
3
+ Version: 2.11.30
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=6f3QGzoUPy-Ig8Md0QTeVuLBdtsArggZ3OXJsOfGxxI,124
1
+ atomicshop/__init__.py,sha256=0yKixDn2ebzNbUhatDcnc-bep-dodkvVk_4xKZbeF_8,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
@@ -149,7 +149,7 @@ atomicshop/wrappers/ffmpegw.py,sha256=wcq0ZnAe0yajBOuTKZCCaKI7CDBjkq7FAgdW5IsKcV
149
149
  atomicshop/wrappers/githubw.py,sha256=mQGtj6up1HIvjOD2t0bmOWjLooJLYvuIa7d7H-tknrw,9998
150
150
  atomicshop/wrappers/numpyw.py,sha256=sBV4gSKyr23kXTalqAb1oqttzE_2XxBooCui66jbAqc,1025
151
151
  atomicshop/wrappers/olefilew.py,sha256=biD5m58rogifCYmYhJBrAFb9O_Bn_spLek_9HofLeYE,2051
152
- atomicshop/wrappers/pipw.py,sha256=iq4pDhmrHqKbcRi3Y6_v2PQSdb4fqfAx79rsX7JEmXo,801
152
+ atomicshop/wrappers/pipw.py,sha256=mu4jnHkSaYNfpBiLZKMZxEX_E2LqW5BVthMZkblPB_c,1317
153
153
  atomicshop/wrappers/process_wrapper_pbtk.py,sha256=ycPmBRnv627RWks6N8OhxJQe8Gu3h3Vwj-4HswPOw0k,599
154
154
  atomicshop/wrappers/pyopensslw.py,sha256=OBWxA6EJ2vU_Qlf4M8m6ilcG3hyYB4yB0EsXUf7NhEU,6804
155
155
  atomicshop/wrappers/ubuntu_terminal.py,sha256=Kodf7FLBplqfLR86YaXb-JlkRVORPgLVS5P6aHkx-Vg,9541
@@ -181,14 +181,14 @@ atomicshop/wrappers/elasticsearchw/queries/size.py,sha256=ZThvspfxpXRBI6Mht9kkb5
181
181
  atomicshop/wrappers/elasticsearchw/queries/sort.py,sha256=-CUhgcs_AVRvncRlLTl5IJZE8K3RgDNLYSIHnn0j7aE,1274
182
182
  atomicshop/wrappers/factw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
183
183
  atomicshop/wrappers/factw/config_fact.py,sha256=J-K9Zn50WcDC7ubb-boraSZExfBk7a6M52NhRJVlsjk,895
184
- atomicshop/wrappers/factw/config_install.py,sha256=QRygFnZ5r1ybJQl7ftFci3kNRmU-a-w3lMG1joElvcY,417
184
+ atomicshop/wrappers/factw/config_install.py,sha256=N-6Fg4Z_aG33r0WGlYgBQTFnamJceYyW4XjnGyyNAks,555
185
185
  atomicshop/wrappers/factw/get_file_data.py,sha256=ChKC0OjgjFlNubZQBwcGhRO3L2pccc27RLRlAMIUix4,1641
186
186
  atomicshop/wrappers/factw/fact_extractor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
187
187
  atomicshop/wrappers/factw/fact_extractor/docker_image.py,sha256=jJAoJNQ4aoATjn3x_va031Obb4oBtcqCY40hydghm0s,2504
188
188
  atomicshop/wrappers/factw/fact_extractor/get_extractor.py,sha256=2mfOAftHIlCcGt1s7MWdq7DsDCuI6wX3MtvcEZ4SK-0,756
189
189
  atomicshop/wrappers/factw/install/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
190
190
  atomicshop/wrappers/factw/install/install_after_restart.py,sha256=-VXC3KDX2BzF0oi0ELCmfch55vLk-3t16KxlmYyUGD8,1560
191
- atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py,sha256=zM2255NB5H4drXlbkIy2r87JkgsJ04BlOoImafwjimU,4519
191
+ atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py,sha256=YhFqqwS_jtgksg7U-4SzegMZayrblxVdsavm7Myx3r4,5340
192
192
  atomicshop/wrappers/factw/postgresql/__init__.py,sha256=xMBn2d3Exo23IPP2F_9-SXmOlhFbwWDgS9KwozSTjA0,162
193
193
  atomicshop/wrappers/factw/postgresql/analysis.py,sha256=2Rxzy2jyq3zEKIo53z8VkjuslKE_i5mq2ZpmJAvyd6U,716
194
194
  atomicshop/wrappers/factw/postgresql/file_object.py,sha256=VRiCXnsd6yDbnsE-TEKYPC-gkAgFVkE6rygRrJLQShI,713
@@ -243,8 +243,8 @@ atomicshop/wrappers/socketw/socket_server_tester.py,sha256=AhpurHJmP2kgzHaUbq5ey
243
243
  atomicshop/wrappers/socketw/socket_wrapper.py,sha256=aXBwlEIJhFT0-c4i8iNlFx2It9VpCEpsv--5Oqcpxao,11624
244
244
  atomicshop/wrappers/socketw/ssl_base.py,sha256=k4V3gwkbq10MvOH4btU4onLX2GNOsSfUAdcHmL1rpVE,2274
245
245
  atomicshop/wrappers/socketw/statistics_csv.py,sha256=t3dtDEfN47CfYVi0CW6Kc2QHTEeZVyYhc57IYYh5nmA,826
246
- atomicshop-2.11.28.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
247
- atomicshop-2.11.28.dist-info/METADATA,sha256=sBBYP7_MHuNOGgSjvNxHMU45ikwo26uNxozs-uWaBdQ,10448
248
- atomicshop-2.11.28.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
249
- atomicshop-2.11.28.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
250
- atomicshop-2.11.28.dist-info/RECORD,,
246
+ atomicshop-2.11.30.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
247
+ atomicshop-2.11.30.dist-info/METADATA,sha256=tkLSN2TVqMjpjvq0hp2JNJSkdSetzDxkF7wK4eeMoe0,10448
248
+ atomicshop-2.11.30.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
249
+ atomicshop-2.11.30.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
250
+ atomicshop-2.11.30.dist-info/RECORD,,