質問編集履歴
1
コードの詳細化etc...
test
CHANGED
File without changes
|
test
CHANGED
@@ -9,14 +9,35 @@
|
|
9
9
|
|
10
10
|
### 発生している問題・エラーメッセージ
|
11
11
|
|
12
|
+
```shell
|
13
|
+
PS C:\Users\hm74c\OneDrive\ドキュメント\pythonライブラリ\_sakurapkg\_sakurapkg\core> sakura debug pip
|
14
|
+
● pip
|
15
|
+
https://pypi.org
|
16
|
+
pip
|
17
|
+
|
18
|
+
[Errno 13] Permission denied: './sakurapkg_dependencies/dist/pip'```
|
12
19
|
```
|
13
|
-
|
20
|
+
上以外の出力はありません。
|
14
|
-
'./sakurapkg_dependencies/dist/pip'
|
15
|
-
```
|
16
21
|
|
17
22
|
### 該当のソースコード
|
18
23
|
|
19
24
|
```python
|
25
|
+
import importlib.util
|
26
|
+
import shutil
|
27
|
+
import os
|
28
|
+
import glob
|
29
|
+
import site
|
30
|
+
import platform
|
31
|
+
import httpx
|
32
|
+
import urllib.request
|
33
|
+
from bs4 import BeautifulSoup
|
34
|
+
from lxml import html
|
35
|
+
import json
|
36
|
+
import re
|
37
|
+
import zipfile
|
38
|
+
import sys
|
39
|
+
import stat
|
40
|
+
|
20
41
|
def get(self, package, url="https://pypi.org", verison=None):
|
21
42
|
print(url)
|
22
43
|
print(package)
|
@@ -64,7 +85,82 @@
|
|
64
85
|
#os.removedirs(f"./sakurapkg_dependencies/dist/{name}")
|
65
86
|
return meta
|
66
87
|
```
|
88
|
+
##呼び出し元
|
89
|
+
```python
|
90
|
+
import toml
|
91
|
+
from toml.decoder import TomlDecodeError
|
92
|
+
from cleo.commands.command import Command
|
93
|
+
from cleo.helpers import argument, option
|
94
|
+
import logging, os, requests, sys, subprocess, re, platform
|
95
|
+
import itertools
|
96
|
+
import threading
|
97
|
+
import time
|
98
|
+
import sakurapkg
|
99
|
+
from sakurapkg.exceptions import sakurapkg_error
|
100
|
+
import build
|
101
|
+
from pathlib import Path
|
102
|
+
import site
|
103
|
+
import zipfile
|
104
|
+
import sys
|
67
105
|
|
106
|
+
logger = logging.getLogger(__name__)
|
107
|
+
logging.basicConfig()
|
108
|
+
|
109
|
+
class Color:
|
110
|
+
BLACK = '\033[30m'#(文字)黒
|
111
|
+
RED = '\033[31m'#(文字)赤
|
112
|
+
GREEN = '\033[32m'#(文字)緑
|
113
|
+
YELLOW = '\033[33m'#(文字)黄
|
114
|
+
BLUE = '\033[34m'#(文字)青
|
115
|
+
MAGENTA = '\033[35m'#(文字)マゼンタ
|
116
|
+
CYAN = '\033[36m'#(文字)シアン
|
117
|
+
WHITE = '\033[37m'#(文字)白
|
118
|
+
COLOR_DEFAULT = '\033[39m'#文字色をデフォルトに戻す
|
119
|
+
BOLD = '\033[1m'#太字
|
120
|
+
UNDERLINE = '\033[4m'#下線
|
121
|
+
INVISIBLE = '\033[08m'#不可視
|
122
|
+
REVERCE = '\033[07m'#文字色と背景色を反転
|
123
|
+
BG_BLACK = '\033[40m'#(背景)黒
|
124
|
+
BG_RED = '\033[41m'#(背景)赤
|
125
|
+
BG_GREEN = '\033[42m'#(背景)緑
|
126
|
+
BG_YELLOW = '\033[43m'#(背景)黄
|
127
|
+
BG_BLUE = '\033[44m'#(背景)青
|
128
|
+
BG_MAGENTA = '\033[45m'#(背景)マゼンタ
|
129
|
+
BG_CYAN = '\033[46m'#(背景)シアン
|
130
|
+
BG_WHITE = '\033[47m'#(背景)白
|
131
|
+
BG_DEFAULT = '\033[49m'#背景色をデフォルトに戻す
|
132
|
+
RESET = '\033[0m'#全てリセット
|
133
|
+
|
134
|
+
class debugger(Command):
|
135
|
+
name = "debug"
|
136
|
+
description = "sakurapkg debugger"
|
137
|
+
arguments = [
|
138
|
+
argument(
|
139
|
+
"package"
|
140
|
+
)
|
141
|
+
]
|
142
|
+
|
143
|
+
def handle(self):
|
144
|
+
package = self.argument("package")
|
145
|
+
#commands = self.argument("cmd")
|
146
|
+
sys.stdout.write(f"\r{Color.BLUE}●{Color.RESET} {package}")
|
147
|
+
sys.stdout.flush()
|
148
|
+
print()
|
149
|
+
from _sakurapkg.core import install_pkg
|
150
|
+
Installer = install_pkg.Installer()
|
151
|
+
meta = Installer.get(package=package, url="https://pypi.org")
|
152
|
+
sys.stdout.write(f"\r{Color.GREEN}●{Color.RESET} {package}")
|
153
|
+
sys.stdout.flush()
|
154
|
+
if len(meta) > 0:
|
155
|
+
for i in range(len(meta)):
|
156
|
+
Installer.get_requires(package=meta[i], url="https://pypi.org")
|
157
|
+
else:
|
158
|
+
return
|
159
|
+
#if commands == "install":
|
160
|
+
# installer = install_pkg.Installer
|
161
|
+
# installer.get(name=package)
|
162
|
+
|
163
|
+
```
|
68
164
|
### 試したこと
|
69
165
|
|
70
166
|
- 管理者権限で実行
|