apscale-installer 0.2__tar.gz → 0.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apscale_installer
3
- Version: 0.2
3
+ Version: 0.3
4
4
  Summary: Advanced Pipeline for Simple yet Comprehensive AnaLysEs of DNA metabarcoding data - Conda installer (workaround)
5
5
  Home-page: https://pypi.org/project/apscale_installer/
6
6
  Author: Till-Hendrik Macher
@@ -24,17 +24,29 @@ def download_blast(url, file_name):
24
24
 
25
25
  extract_path = os.path.dirname(file_name)
26
26
 
27
- # Open the tar.gz file
28
- with tarfile.open(file_name, "r:gz") as tar:
29
- # Extract all the contents to the same directory
30
- tar.extractall(path=extract_path)
27
+ # Extract the file based on its extension
28
+ if file_name.endswith('.tar.gz') or file_name.endswith('.tgz'):
29
+ shutil.unpack_archive(file_name, extract_path, 'gztar')
30
+ folder = file_name.replace('.tar.gz', '').replace('.tgz', '')
31
+ elif file_name.endswith('.tar.bz2') or file_name.endswith('.tbz'):
32
+ shutil.unpack_archive(file_name, extract_path, 'bztar')
33
+ folder = file_name.replace('.tar.bz2', '').replace('.bztar', '')
34
+ elif file_name.endswith('.tar.xz') or file_name.endswith('.txz'):
35
+ shutil.unpack_archive(file_name, extract_path, 'xztar')
36
+ folder = file_name.replace('.tar.xz', '').replace('.xztar', '')
37
+ elif file_name.endswith('.zip'):
38
+ shutil.unpack_archive(file_name, extract_path, 'zip')
39
+ folder = file_name.replace('.zip', '')
40
+
31
41
  print("Unpacking complete!")
32
42
 
33
43
  ########################################################################################################################
34
44
  ## Find install directory
35
45
 
46
+ print(os.environ['PATH'])
47
+
36
48
  # Run the conda info command
37
- result = subprocess.run(['conda', 'info', '--json'], stdout=subprocess.PIPE)
49
+ result = subprocess.run('conda info --json', shell=True, stdout=subprocess.PIPE)
38
50
  # Parse the JSON output
39
51
  conda_info = json.loads(result.stdout)
40
52
  # Get the current environment path
@@ -55,13 +67,13 @@ def download_blast(url, file_name):
55
67
  for file in bin_files:
56
68
  moved_file = env_path.joinpath(Path(file).name)
57
69
  shutil.copy(file, moved_file)
58
- print("Finished installation!")
70
+ print("Copied files!")
59
71
 
60
72
  ########################################################################################################################
61
73
  ## Update PATH
62
74
 
63
75
  os.environ["PATH"] += os.pathsep + str(env_path)
64
- print(f"Updated PATH: {os.environ['PATH']}")
76
+ print("Finished installation!")
65
77
 
66
78
  def download_vsearch(url, file_name):
67
79
  ########################################################################################################################
@@ -79,17 +91,27 @@ def download_vsearch(url, file_name):
79
91
 
80
92
  extract_path = os.path.dirname(file_name)
81
93
 
82
- # Open the tar.gz file
83
- with tarfile.open(file_name, "r:gz") as tar:
84
- # Extract all the contents to the same directory
85
- tar.extractall(path=extract_path)
94
+ # Extract the file based on its extension
95
+ if file_name.endswith('.tar.gz') or file_name.endswith('.tgz'):
96
+ shutil.unpack_archive(file_name, extract_path, 'gztar')
97
+ folder = file_name.replace('.tar.gz', '').replace('.tgz', '')
98
+ elif file_name.endswith('.tar.bz2') or file_name.endswith('.tbz'):
99
+ shutil.unpack_archive(file_name, extract_path, 'bztar')
100
+ folder = file_name.replace('.tar.bz2', '').replace('.bztar', '')
101
+ elif file_name.endswith('.tar.xz') or file_name.endswith('.txz'):
102
+ shutil.unpack_archive(file_name, extract_path, 'xztar')
103
+ folder = file_name.replace('.tar.xz', '').replace('.xztar', '')
104
+ elif file_name.endswith('.zip'):
105
+ shutil.unpack_archive(file_name, extract_path, 'zip')
106
+ folder = file_name.replace('.zip', '')
107
+
86
108
  print("Unpacking complete!")
87
109
 
88
110
  ########################################################################################################################
89
111
  ## Find install directory
90
112
 
91
113
  # Run the conda info command
92
- result = subprocess.run(['conda', 'info', '--json'], stdout=subprocess.PIPE)
114
+ result = subprocess.run('conda info --json', shell=True, stdout=subprocess.PIPE)
93
115
  # Parse the JSON output
94
116
  conda_info = json.loads(result.stdout)
95
117
  # Get the current environment path
@@ -103,20 +125,19 @@ def download_vsearch(url, file_name):
103
125
  ## Move files to bin
104
126
 
105
127
  # Collect files
106
- folder = file_name.replace('.tar.gz', '')
107
128
  bin_files = glob.glob(str(Path(f'./{extract_path}/{folder}/bin/*')))
108
129
 
109
130
  # Move files
110
131
  for file in bin_files:
111
132
  moved_file = env_path.joinpath(Path(file).name)
112
133
  shutil.copy(file, moved_file)
113
- print("Finished installation!")
134
+ print("Copied files!")
114
135
 
115
136
  ########################################################################################################################
116
137
  ## Update PATH
117
138
 
118
139
  os.environ["PATH"] += os.pathsep + str(env_path)
119
- print(f"Updated PATH: {os.environ['PATH']}")
140
+ print("Finished installation!")
120
141
 
121
142
  def main():
122
143
  ## OS-specific download
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apscale_installer
3
- Version: 0.2
3
+ Version: 0.3
4
4
  Summary: Advanced Pipeline for Simple yet Comprehensive AnaLysEs of DNA metabarcoding data - Conda installer (workaround)
5
5
  Home-page: https://pypi.org/project/apscale_installer/
6
6
  Author: Till-Hendrik Macher
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="apscale_installer",
8
- version="0.2",
8
+ version="0.3",
9
9
  author="Till-Hendrik Macher",
10
10
  author_email="macher@uni-trier.de",
11
11
  description="Advanced Pipeline for Simple yet Comprehensive AnaLysEs of DNA metabarcoding data - Conda installer (workaround)",
File without changes