[Simple-cdd-devel] Bug#861198: Shutting down public FTP services
Enrico Zini
enrico at enricozini.org
Mon May 15 18:35:19 UTC 2017
On Mon, May 15, 2017 at 11:25:06AM -0700, Vagrant Cascadian wrote:
> >> > - prefix_len = 7 + len(env.get("DI_CODENAME")) # dists/{DI_CODENAME}/
> >> > - relname = file[prefix_len:]
> >> > + separator = os.path.join('dists/', env.get("DI_CODENAME"), '')
> >> > + separator, relname = file.split(separator)
> >> If I remember correctly, it is trying to split a filename based on
> >> dists/CODENAME, so maybe os.path.split would be appropriate here; will
> >> look into it.
>
> os.path.split only takes a single argument, and splits in a
> predetermined way. e.g. /foo/bar/baz is split into /foo/bar and baz.
Ah right. I keep instinctively thinking that os.path.split splits a path
into a list of path components.
> > os.path.relpath might also help.
>
> This also takes a single argument, turning a full path into a relative
> path. e.g. /foo/bar/baz gives ../../../foo/bar/baz
It should take an optional start= argument. I was thinking something
like this:
os.path.relpath(path, start=os.path.join("dists", env.get("DI_CODENAME")))
> So, I'm not sure either of those will be helpful here. To keep the diff
> small, I could just revert to your original code, as it works and my
> change there isn't strictly necessary; it's just easier for me to see
> what's going on.
If it's easier to see what's going on, by all means keep your code.
Enrico
--
GPG key: 4096R/634F4BD1E7AD5568 2009-05-08 Enrico Zini <enrico at enricozini.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/simple-cdd-devel/attachments/20170515/8106849a/attachment.sig>
More information about the Simple-cdd-devel
mailing list