Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #110 from leaphy-robotics/python-editor
Browse files Browse the repository at this point in the history
chore: more stability added
  • Loading branch information
koen1711 authored Jan 21, 2024
2 parents 2db5221 + 6f7d449 commit 47151fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/app/services/python-uploader/filesystem/FileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ async function mkdir(writer: WritableStreamDefaultWriter, reader: ReadableStream
if (failed) {
throw new Error(stdErr);
}
return stdOut;
}

async function ls(writer: WritableStreamDefaultWriter, reader: ReadableStreamDefaultReader, path: string): Promise<{name: string, isDir: boolean}[]> {
Expand Down
13 changes: 10 additions & 3 deletions src/app/services/python-uploader/mip/PackageManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {get, ls, put, rm, rmdir} from "../filesystem/FileSystem";
import {get, ls, mkdir, put, rm, rmdir} from "../filesystem/FileSystem";


export class PackageManager {
Expand Down Expand Up @@ -51,6 +51,13 @@ export class PackageManager {
if (!url) {
throw new Error('No url provided');
} else if (url.startsWith('github:')) {
let writer = this.serialPort.writable.getWriter();
let reader = this.serialPort.readable.getReader();
try {
await mkdir(writer, reader, '/lib');
} catch (error) {}
writer.releaseLock();
reader.releaseLock();
let json = JSON.parse(await PackageManager.fetchMipUrl(url));
const version = json['version'];
if (await this.checkLibraryVersion(version, PackageManager.getLibraryName(url))) {
Expand All @@ -64,8 +71,8 @@ export class PackageManager {
content.push({name: '/lib/' + file[0], content: response});
}

const writer = this.serialPort.writable.getWriter();
const reader = this.serialPort.readable.getReader();
writer = this.serialPort.writable.getWriter();
reader = this.serialPort.readable.getReader();
// get a list of .dist-info files in the lib folder and delete them
const response = await ls(writer, reader, '/lib');
// get a list of all the .dist-info folders
Expand Down

0 comments on commit 47151fb

Please sign in to comment.