Re: [Python-Dev] HAVE_FSTAT?

2013-06-05 Thread Hossein

Hi. My 2 cents about this: (well I'm only a noob)

I had this problem; I don't know about other people's environment, but 
my environment's problem was that it was actually not POSIX-compliant: 
it didn't have other file functions as well, but anyway the `fstat` 
error is the FIRST error you get when you compile in such environments, 
so people as unaware as me think the problem is with fstat only.


Anyway I think if you are going to remove anything, you should think in 
terms of POSIX-compliancy of the target system. Removing HAVE_FSTAT 
might be fine (as user can easily write his own version of the function 
and have it included into the python's sources), but if you instead 
provide the user with the ability to use his custom functions when POSIX 
one's aren't available, it would help make python compile on even more 
platforms. Sorry if this last one was off-topic.


Best regards.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Compiling the source without stat

2011-12-15 Thread Hossein
I wanted to say something in the bug page petri showed ( 
http://bugs.python.org/issue12082 ) however I though about first 
discussing it here. If faking a stat struct and a function to fill it 
solves the problem, and checking for existing files and folders is the 
only thing that python needs to be compiled (i'm talking about 2.7) then 
it's possible to fail-check it by just trying to open the file.


If you don't want to change the stat mechanism, you can create a new 
#define which can let user point it to his own faked stat function and 
struct.
I'm currently trying to fake stat to see what happens next, but I guess 
I will have more problems with file handling later.


By the way, some people with the same problem there said they used 
python by setting the Py_DontWriteBytecodeFlag flag, but here my problem 
is that i can't compile it. Dunno what they really did.

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Compiling the source without stat

2011-12-15 Thread Hossein Azadmanesh
It does have its own file handling functions: Opening, getting the size, 
enumerating directories, etc.
It has its own limitations too. No dates supported, folders only one 
level deep, maximum 99 files inside each folder, etc.
There is not a function called stat. But I am considering faking it, 
will explain in another reply.

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Compiling the source without stat

2011-12-14 Thread Hossein
Hi. I just started to port latest python 2.7.2 to another platform 
(don't think you're eager to know... well it's CASIO ClassPad).
And I faced a minor problem... It hasn't got stat or fstat or 
anything. (It supports a very limited set of c std lib).
As pyport.c suggested, i defined both DONT_HAVE_STAT and 
DONT_HAVE_FSTAT, but problems only began.
It failed to compile most of import.c, particularly because it fell into 
the wrong `#if !defined(PYOS_Something)' blocks. Sometimes it just fell 
into an #else part which assumed stat are available. So although 
HAVE_STAT is meant to control file operations, most of the source code 
aren't implement to use it. You see how minor the problem was?

So now I need advice from developers.
Is there a fix for it? What a question... definitely no replacement to stat.
It's 99% definite that I can't compile further without touching the 
source code. I have to #define my own PYOS_whatever and handle files in 
my own way. In that case where should my special file handling cases go? 
I saw some marshal.c code which seemed it wants to abstract away 
platform's file handling from source code; but from what I understood it 
can't be made to use alternate file handling methods.
If there is anything I should do (maybe show you my handmade 
pyconfig.h?) tell me.
[My first post in a mailing list... Should I say] Best Regards, Hossein 
[in here?]

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com