mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 18:17:13 +02:00
Move "get_project_id" to the project helpers
This commit is contained in:
@ -258,10 +258,6 @@ def get_cid():
|
|||||||
return cid
|
return cid
|
||||||
|
|
||||||
|
|
||||||
def get_project_id(project_dir):
|
|
||||||
return hashlib.sha1(hashlib_encode_data(project_dir)).hexdigest()
|
|
||||||
|
|
||||||
|
|
||||||
def get_user_agent():
|
def get_user_agent():
|
||||||
data = [
|
data = [
|
||||||
"PlatformIO/%s" % __version__,
|
"PlatformIO/%s" % __version__,
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -28,6 +29,12 @@ def get_project_dir():
|
|||||||
return os.getcwd()
|
return os.getcwd()
|
||||||
|
|
||||||
|
|
||||||
|
def get_project_id(project_dir=None):
|
||||||
|
return hashlib.sha1(
|
||||||
|
hashlib_encode_data(project_dir or get_project_dir())
|
||||||
|
).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
def is_platformio_project(project_dir=None):
|
def is_platformio_project(project_dir=None):
|
||||||
if not project_dir:
|
if not project_dir:
|
||||||
project_dir = get_project_dir()
|
project_dir = get_project_dir()
|
||||||
|
@ -29,6 +29,7 @@ from platformio.cli import PlatformioCLI
|
|||||||
from platformio.debug.config.base import DebugConfigBase
|
from platformio.debug.config.base import DebugConfigBase
|
||||||
from platformio.http import HTTPSession, ensure_internet_on
|
from platformio.http import HTTPSession, ensure_internet_on
|
||||||
from platformio.proc import is_ci
|
from platformio.proc import is_ci
|
||||||
|
from platformio.project.helpers import get_project_id
|
||||||
|
|
||||||
KEEP_MAX_REPORTS = 100
|
KEEP_MAX_REPORTS = 100
|
||||||
SEND_MAX_EVENTS = 25
|
SEND_MAX_EVENTS = 25
|
||||||
@ -218,7 +219,7 @@ def dump_project_env_params(config, env, platform):
|
|||||||
for option in non_sensitive_data
|
for option in non_sensitive_data
|
||||||
if config.has_option(section, option)
|
if config.has_option(section, option)
|
||||||
}
|
}
|
||||||
params["pid"] = app.get_project_id(os.path.dirname(config.path))
|
params["pid"] = get_project_id(os.path.dirname(config.path))
|
||||||
params["platform_name"] = platform.name
|
params["platform_name"] = platform.name
|
||||||
params["platform_version"] = platform.version
|
params["platform_version"] = platform.version
|
||||||
return params
|
return params
|
||||||
|
Reference in New Issue
Block a user